Questions tagged [ember-data]

ember-data is a data persistence extension for the Ember.js framework.

Because the MVC framework builds applications which run in the browser rather than returning fully-rendered pages in response to browser requests, it requires a method for saving and reloading user data.

Ember.js supports a number of "data persistence" libraries, including a data store component inherited from the framework. In general these frameworks support CRUD operations on a RESTful web service, and as such they are agnostic regarding the technology of the back-end web service.

Ember-data is the "official" data persistence library for Ember.js, supported by the Ember.js team. It uses "adapters" to load data for use by Ember.js applications, and allows developers to write custom adapters to support their own specific data store.

Beta Period

During the beta period (up until 1.0) the API is constantly changing, you can keep up to date by reading the Transition Document.

Getting help

Ember-data is supported in much the same way as Ember.js itself.

The Stack Overflow tag is actively monitored by several contributors to Ember. You may try asking questions in the active IRC channel #emberjs on irc.freenode.net. Other resources can found on the Ember.js community page

Technical questions that are accompanied by working code make it easier for other to help give good answers. JSFiddle | JSBin

To report bugs against Ember.js, or to propose new functionality, create an issue on the Github project.

5458 questions
86
votes
8 answers

How to use multiple models with a single route in EmberJS / Ember Data?

From reading the docs, it looks like you have to (or should) assign a model to a route like so: App.PostRoute = Ember.Route.extend({ model: function() { return App.Post.find(); } }); What if I need to use several objects in a…
Anonymous
  • 5,875
  • 7
  • 39
  • 68
60
votes
2 answers

Ember js - Hasmany relationships breaks after updating other tables

I am using Ember.js with local-storage-adapter. I have a weird problem while updating records. I have a post and comments model with hasMany relationships: App.Post = DS.Model.extend({ title: DS.attr('string'), comments:…
viji
  • 1,656
  • 2
  • 19
  • 33
55
votes
4 answers

infinite scroll with ember.js (lazy loading)

I have a view where there can be a large number of items for the user to scroll through and I'd like to implement infinite scrolling to enable progressive loading of the content. It looks like some folks have done pagination but Google doesn't…
outside2344
  • 1,959
  • 1
  • 26
  • 50
54
votes
1 answer

Ember CLI testing complicated model relationships

As far as I can see, when testing ember-data models in ember CLI, all relationships have to be listed in needs. This is fine if the structure is simple, but in many cases there will be multiple layers. For example, if models are set up with the…
aquavitae
  • 14,088
  • 7
  • 53
  • 99
53
votes
2 answers

Ember.js: Reloading a .hasMany relationship given through "links" in payload

Say I have two models, Topic and Post: App.Topic = DS.Model.extend({ posts: DS.hasMany('post', { async: true, inverse: 'post' }); }); App.Post = DS.Model.extend({ topic: DS.belongsTo('topic', { async: true }); }); Topic hasMany Posts, and a…
Mike
  • 4,008
  • 18
  • 35
49
votes
7 answers

Access store from component

i have a component and when user click on component it add some value to store,i try to use this way but i get an error : OlapApp.MeasureListItemComponent = Ember.Component.extend({ tagName: 'li', isDisabled: false, attributeBindings:…
MBehtemam
  • 6,516
  • 11
  • 56
  • 98
48
votes
2 answers

What is the complete list of expected JSON responses for DS.RESTAdapter?

I am attempting to write a custom express.js based server for an Ember.js app. I am getting along fairly well but I'm constantly getting stuck trying to guess what JSON responses Ember Data is expecting at a given moment. This brand new…
James Andres
  • 1,532
  • 14
  • 20
42
votes
4 answers

How should errors be handled when using the Ember.js Data RESTAdapter?

ember-data.js: https://github.com/emberjs/data/tree/0396411e39df96c8506de3182c81414c1d0eb981 In short, when there is an error, I want to display error messages in the view, and then the user can 1) cancel, which will rollback the transaction 2)…
michaelvobrien
  • 521
  • 1
  • 5
  • 3
41
votes
3 answers

Caching remote data in Local Storage with EmberData

I have a question about loading and caching remote objects with Ember. I'm developing an Ember app that uses server-side storage through a REST API. Some of the fetched data is rarely changing, so fetching it from the server each time the…
hannes_l
  • 421
  • 4
  • 6
37
votes
2 answers

How to cache query result in ember data

I want to cache the result of a query in ember-data. (findQuery) To make it clear: I don't want to cache the entire models; just what models are the result of the query. Where is the right place for this? I was thinking about implementing this in…
Lux
  • 16,183
  • 3
  • 36
  • 64
35
votes
2 answers

Ember.js & Ember Data: How to create record with hasMany relationship when the parent and child don't exist yet

As seems to be the case with most everything I do with ember-data the simple test case is very simple but anything "real" falls apart quickly due to my lack of understanding (and I think documentation). In the simplest case I have no problem…
Sarus
  • 3,093
  • 1
  • 21
  • 25
30
votes
1 answer

What are the major differences (pros/cons) between ember-model, ember-restless, and emu?

A recent ember-data blog update has suggested to look at ember-model, ember-restless, and emu as alternatives to ember-data to communicate with conventional APIs. Can you please provide a in-depth comparison of these libraries?
Michael
  • 1,129
  • 11
  • 11
30
votes
7 answers

How to represent arrays within ember-data models?

Is it necessary to use DS.hasMany pointing to a DS.Model when a model contains an array? Even if the array elements are not really models (no IDs or endpoints of their own)? Is there a better way? I am using DS.hasMany, but my extended…
dechov
  • 1,833
  • 1
  • 15
  • 18
27
votes
1 answer

How to reload an ember data record?

I'm using the new router and ember data rev 11. I have a need to force ember-data to re-load data for a record from the server. Using App.MyRecord.find(2) in setInterval function loads the data from the client local store. How can I reload the…
ramigg
  • 1,229
  • 1
  • 15
  • 16
23
votes
1 answer

Handling errors with the (now default) Ember Data JSON-API adapter

I am using Ember 1.13.7 and Ember Data 1.13.8, which by default use the JSON-API standard to format the payloads sent to and received from the API. I would like to use Ember Data's built-in error handling in order to display red "error" form fields…
danr1979
  • 461
  • 1
  • 3
  • 10
1
2 3
99 100