내 응용 프로그램에서 사용해야하는지 확인하기 위해 노력하고 있습니다. 간단한 응용 프로그램을 테스트하고 있습니다. 모델 간의 관계를 시험해보고 싶었습니다. 이것은 내가 그 모델 정의가 코드입니다 :관계가있는 Emberjs 모델에서 "정의되지 않은 'store'속성을 설정할 수 없습니다.
var App = Ember.Application.create();
App.Router.map(function() {
this.resource('index', {path: "/"}, function() {
this.resource("config", {path: "/config/:config_id"});
});
});
App.Store = DS.Store.extend();
App.Conf = DS.Model.extend({
module : DS.attr(),
reports: DS.hasMany('report'),
isClean: function() {
return !this.get('reports').isAny('isClean', false);
}.property('[email protected]')
});
App.Report = DS.Model.extend({
country: DS.attr(),
google_account_id: DS.attr(),
web_property_id: DS.attr(),
custom_source_uid: DS.attr(),
isClean: function() {
return (
this.get('country') != '' &&
this.get('google_account_id') != '' &&
this.get('web_property_id') != '' &&
this.get('custom_source_uid') != ''
);
}.property('country', 'google_account_id', 'web_property_id', 'custom_source_uid')
});
App.ApplicationAdapter = DS.RESTAdapter.extend({
host: 'http://playground.loc/battle_of_frameworks/json.php'
});
을 ... 그리고 여기에로드되고있는 JSON입니다 : 내가 오류가
:
은Error while loading route: TypeError: Cannot set property 'store' of undefined
나는 그 문제를 인터넷 검색하고, 일반적으로 귀하의 모델을 복수형 (예 : App.Reports)으로 명명하는 것에 관한 것입니다. 그래서 여기에 어떤 문제가 있는지 잘 모르겠습니다. 아무도 통찰력을 줄 수 있습니까?
고마워. 내가 제안한 모든 변경 사항을 추가하고 json 형식을 변경했다. 건배! – aledujke