my computed values stopped working with latest version of ember-data.js

别来无恙 提交于 2019-12-11 10:57:11

问题


I am getting the following error when i change attributes of a model.

Uncaught Error: <DS.StateManager:ember466> could not respond to event setProperty in state rootState.loading.

Here is the code. http://jsfiddle.net/arenoir/JejwD/ http://jsfiddle.net/arenoir/JejwD/show


回答1:


Since revision 6 of ember-data (see breaking changes), IDs are string-normalized. As a result, you'll need to update your fixtures to use strings for IDs (note: the REST adapter will convert numbers/strings, but the fixture adapter doesn't do any conversions).

Making the following changes to your fixtures seems to get your example working:

App.Address.FIXTURES = [
    {id: '1', streetnumber: '1018', streetname: '4th Ave', city: 'Oakland', state: 'Ca'} 
];

App.Job.FIXTURES = [
    {id: '1', address_id: '1', customer_id: '1', name: 'bathroom addition', rate: "310", hours: "1000"}
];

App.Customer.FIXTURES = [
    {id: '1', firstname: 'Mike', lastname: 'Smith', jobs: ['1']}
];

See http://jsfiddle.net/dgeb/GVU7n/



来源:https://stackoverflow.com/questions/13296022/my-computed-values-stopped-working-with-latest-version-of-ember-data-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!