Rudi
Rudi

Reputation: 1587

use ember-data or ajax calls

I'm looking for some advise on whether to use ember-data or not. My preference would be to use it, but it also has to make sense.

My main set of records will be lat/long records, that need to be displayed on a map. The records I get will depend on the viewport of the map. And ideally, if the viewport changes I load new records, but I also drop some of the records from the store (those that are no longer in view).

I will only get records from the backend. I'll never create new lat/long records on the front end that need to be saved.

Is it wise to go with ember-data or would I be better of using simple ajax calls?

Thanks for your advice.

Upvotes: 2

Views: 495

Answers (2)

ahmacleod
ahmacleod

Reputation: 4310

There's no doubt that ajax calls will be easier in the short term, especially if they are very simple. That said, the point of Ember Data is not just to simplify retrieving data, it's to abstract away the details of your back-end. Say your API changes later on, or you decide to load your data from a websocket. With Ember Data, you only need to write a new adapter, and the rest of your code stays exactly the same. Food for thought.

Upvotes: 0

mavilein
mavilein

Reputation: 11668

I think you should go with simple ajax calls. My unerstanding is that ember data comes in really handy, when you query records by id or you create records in the frontend. Actually ember does not require you to use ember-data. In your case it does not seem to make sense. I myself have implemented a Google Map with emberjs that fetches new points to display on the map, when the user drags a marker. And during the development process i never thought, i should have user ember-data.

Just my 2 cents :-)

Upvotes: 2

Related Questions