私が作成している次のオブジェクトがあります。
Ember.Object.create({
value: function() {
return 'text';
}.property()
});
しかし、私はhas no method 'property'
エラーが発生しています。property
理由はわかりませんが、すべての機能で利用できると思いました。
私が作成している次のオブジェクトがあります。
Ember.Object.create({
value: function() {
return 'text';
}.property()
});
しかし、私はhas no method 'property'
エラーが発生しています。property
理由はわかりませんが、すべての機能で利用できると思いました。
If you open your JavaScript console you'll notice the following error:
Uncaught Error: assertion failed: Ember.Object.create no longer supports defining computed properties.
Try this instead:
App.Object = Ember.Object.extend({
value: function() {
return 'text';
}.property()
});
alert(App.Object.create().get('value'));
In Ember, you should be creating objects, not instances. If you find yourself creating instances of objects like this, then you're probably doing something wrong. There are of course cases where you'll need to create Ember.Object
s straight away, but for them to have computed properties, and to call _super
? I can't think of any valid cases for that, and since they've since been @deprecated, you'll have to find alternative solutions. Better solutions.
プロトタイプ拡張機能を無効にしていたことがわかりました。
http://emberjs.com/guides/configuring-ember/disabling-prototype-extensions/
モデルのドキュメント例を使用してみてください:http://emberjs.com/api/classes/Ember.ComputedProperty.html#method_property