ember와 함께 밑줄 친 json-data를 사용하는 데 문제가 있습니다.Ember : 모델을 밑줄하는 방법
{"check_lists": [
{
"id": 1,
"name": "Example-list-1",
"description": "",
"status": null,
"module_actions": []
},
{
"id": 2,
"name": "Example-list-1",
"description": "",
"status": null,
"module_actions": []
}
}
가장 큰 문제는이 오류 메시지입니다 :
Checktouch.ChecklistsRoute = Ember.Route.extend({
model: function() {
return this.store.find('check_list');
}
});
: 없음 모델은 다음과 같은 경로를 사용하여 'check_list'
을 찾을 수 없습니다 된 체크리스트 :
오류 경로를 처리하는 동안 모델 :
Checktouch.Checklist = DS.Model.extend({
name: DS.attr('string'),
description: DS.attr('string'),
status: DS.attr('string')
});
다음으로 module_actions-attribute가 구현됩니다.
밑줄 표시된 모델 이름에 허용되지 않는 것처럼, 나는 심지어 ember-model에 밑줄 친 json-data를 매핑 할 수 있는지 알지 못합니다.
아무도이 사실을 알지 못합니까? 단지 checklist
모델이 있기 때문에
감사합니다. 조사하는 것이 좋은 지적이었습니다. store.find ('check_list')를 store.find ('checklist')로 변경 한 후 체크리스트 ChecklistSerializer의 추출 메서드를 덮어 썼을뿐입니다. extract : function (store, type, payload, id, requestType) { payload .checklists = payload.check_lists; 삭제 payload.check_lists; this._super (store, type, payload, id, requestType)를 반환합니다. } 지금까지 작동합니다. – user3824647