사용자를로드 한 후에 내 RESTAdapter의 헤더를 변경하려고하지만 속성에 액세스 할 수 없습니다.Ember.js -로드 된 레코드에 액세스 할 수 없습니다.
어떤 아이디어가 필요한가요?
관련 코드 :
var user = '';
App.MainRoute = Ember.Route.extend({
model: function(params){
user = this.store.find('user',{email: params.email});
alert(user.hash); //get a undefined
return user;
},
actions:{
addList: function(){
var list = this.store.createRecord('list', {
name: 'New list',
desc: 'Describe it here'
});
this.store.find('user', 1).then(function(user){
list.set('user', user);
})
list.save();
}
}
})
this.store.find('user', {email: params.email});
에 JSON 응답 :
{
"users": [
{
"id": 1,
"hash": "66ff7d6eae591ca2a7d6b419991690e8",
"email": "[email protected]",
"name": "",
"lists": []
}
]
}
모델 정의 : https://gist.github.com/Osile/5544ccab1997c4da2b5b
모든 오류 당신은 다음과 같은 Handlebars.js 템플릿을 사용할 수 있습니까? –
아니요, 슬프게도 .. –
'user'와'list'에 대해'DS.Model'을 정의 할 수 있습니까? 코드를 공유 할 수 있습니까? –