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.

5483 questions
11
votes
2 answers

EmberJS: How to Redirect from Route, Keeping Query Params

I want to redirect from a route, /new, and keep the query params for the new route: As far as I know, the only place to access queryParams is within the model hook of a route. But I want to redirect in the beforeModel hook: import Ember from…
user1429980
  • 6,872
  • 2
  • 43
  • 53
11
votes
4 answers

Difference between this.get('model') and modelFor

I am quite new to ember and don't really get the difference between two types of syntax. Where and in which situations should i use one or another. I.e. Which one is more suitable for usage in Routes and which one for…
canufeel
  • 893
  • 1
  • 11
  • 22
11
votes
4 answers

How is Sorting achieved in an Ember model without using Array Controller?

Every google result is about an ArrayController sorting. Need a sorting mechanism without using ArrayController. There is a model where there are sort params. Like say 'sortOrder' as one of the properties in the model (which will be from a back…
Abhilash L R
  • 805
  • 1
  • 9
  • 24
11
votes
1 answer

How do I depend on the store as a service in Ember unit tests using qunit?

According to the blog-post for ember-data version 1.0.0-beta.16 the store can now be used as a service: TweetComposerComponent = Ember.Component.extend({ store: Ember.inject.service() }); However, I can't figure out how to do qunit unit…
Kevin Bullaughey
  • 2,556
  • 25
  • 37
11
votes
1 answer

Ember-table integration with Ember-model / Ember-data

I am trying to link ember-models to the ember-table to pull paginated records from the server and add them to the table when scrolling down. I can get it working by just requesting my api url with page number like in the ajax example on…
Rick Moss
  • 926
  • 1
  • 17
  • 34
11
votes
1 answer

How to (De)serialize field from object based on annotation using Jackson?

I need to configure Jackson in a specific way which I'll describe below. Requirements Annotated fields are serialized with only their id: If the field is a normal object, serialize its id If the field is a collection of objects, serialize an…
miguelcobain
  • 4,734
  • 4
  • 32
  • 45
11
votes
1 answer

How to render hasMany relationship data?

How can I get the following example code to render not just the person data but also the phone numbers of that person when rendering the URL /#/persons/1. I try to loop though the phone numbers with {{#each phoneNumber in phoneNumbers}} but there…
wintermeyer
  • 8,178
  • 8
  • 39
  • 85
11
votes
3 answers

Delete associated model with ember-data

I have two models: App.User = DS.Model.create({ comments: DS.hasMany('App.Comment') }); App.Comment = DS.Model.create({ user: DS.belongsTo('App.User') }); When a user is deleted, it also will delete all its comments on the backend, so I should…
josepjaume
  • 419
  • 5
  • 15
11
votes
3 answers

Ember.js ember-data restadapter fail to load json

Cheers! I have ember-data store: TravelClient.Store = DS.Store.extend({ revision: 11, adapter: DS.RESTAdapter.create({ bulkCommit: false, url: "http://someIP:somePORT"}) }); And router: TravelClient.ToursRoute = Ember.Route.extend({ model:…
xamenrax
  • 1,724
  • 3
  • 27
  • 47
11
votes
4 answers

Could someone point me to an ember.js project that uses the latest routing system? Bonus points if it uses ember-data as well

I'm making my first project with ember.js, and so far haven't been able to find any example projects that use the new routing system. All the examples from the ember docs use the old routing. Also, I'd love to see an example of a project that…
Chris
  • 719
  • 1
  • 7
  • 22
11
votes
4 answers

emberjs handle 401 not authorized

I am building an ember.js application and am hung up on authentication. The json rest backend is rails. Every request is authenticated using a session cookie (warden). When a user first navigates to the application root rails redirects to a login…
Aaron Renoir
  • 4,283
  • 1
  • 39
  • 61
11
votes
3 answers

Ember-Data: How do "mappings" work

I'm currently trying to put something together with ember + emberdata + router + asp.net web api. Most of it seem to work, however I stuck in an error message I get when ember-data tries to findAll through the adapter for my models. In my backend I…
11
votes
3 answers

Ember-Data recursive hasMany association

Has anyone used ember-data to model a tree of data? I would assume it would be something like: Node = DS.Model.extend({ children: DS.hasMany(Node), parent: DS.belongsTo(Node) }); However, I have not been able to get this working which…
Heuristocrat
  • 163
  • 1
  • 6
10
votes
2 answers

How to access the Ember Data Store from the console?

In Ember 2+, does anyone know how to get a reference to the Ember Store in order to troubleshoot Model mapping in the javascript console? It was possible through App.__container__.lookup in Ember 1, but this doesn't exist anymore, and it's bloody…
Fabien Benoit-Koch
  • 2,784
  • 2
  • 21
  • 33
10
votes
1 answer

EmberJS / Ember-Data: 404's Not Getting Caught

I am trying to catch 404 errors in my ember app, and redirect to /not-found. I have an errors action on my ApplicationController, and I have an RSVP.on('error') function too but the 404's aren't getting caught. I just get a 404 error thrown to my…
Brandon
  • 3,091
  • 2
  • 34
  • 64