问题描述
更改模型属性时出现以下错误。
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.
这里是代码。 http://jsfiddle.net/arenoir/ JejwD / show
Here is the code. http://jsfiddle.net/arenoir/JejwD/ http://jsfiddle.net/arenoir/JejwD/show
推荐答案
从ember-data的修订版6开始(请参见),ID是字符串标准化的。结果,您将需要更新灯具以将字符串用于ID(请注意:REST适配器将转换数字/字符串,但是灯具适配器不进行任何转换)。
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']}
];
请参见
这篇关于我的计算值停止使用最新版本的ember-data.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!