2014-04-03 3 views
0
정의되지 않은

의 설정할 수 없습니다 재산 '저장'나는 의 RESTful APIEmber.js 응용 프로그램을 만드는, 그리고 난이 오류로 실행 :Ember.js :

Error while loading route: TypeError: Cannot set property 'store' of undefined 

나는 알아낼 수 없습니다 무엇이 이것을 일으키는 지.

window.App = Ember.Application.create(); 

App.VideosAdapter = DS.MyRESTAdapter; 

App.Router.map(function() { 
    this.resource('videos', { 
     path: '/' 
    }); 
}); 

App.Video = DS.Model.extend({ 
    title: DS.attr('number'), 
    videoId: DS.attr('string'), 
    date: DS.attr('string') 
}); 

App.VideosAdapter = DS.RESTAdapter.extend({ 
    namespace: 'data' 
}); 

App.VideosRoute = Ember.Route.extend({ 
    model: function() { 
     return this.store.find(); 
    } 
}); 

디버그 정보는 :

DEBUG: ------------------------------- 
DEBUG: ember.js:3880 
DEBUG: Ember  : 1.7.0-beta.1+canary.2eae2280 ember.js:3880 
DEBUG: Ember Data : 1.0.0-beta.7+canary.20adb1d5 ember.js:3880 
DEBUG: Handlebars : 1.3.0 ember.js:3880 
DEBUG: jQuery  : 1.10.2 ember.js:3880 
DEBUG: ------------------------------- 

내가 이렇게 내 경로를 변경하려고 :

App.VideosRoute = Ember.Route.extend({ 
    model: function() { 
     return App.Video.find(); 
    } 
}); 

을하지만 오류가있어 : 이것은 내 JSON 데이터를

Error while loading route: TypeError: Object function() { .. } has no method 'find' 

입니다 (http://localhost/data/videos/1) (그것은 좋은 int로드 오 엠버 경위) :

{ 
    "video": { 
     "id": 1, 
     "title": "Video title!", 
     "videoId": "AAZ23", 
     "date": "12/122013" 
    } 
} 
+0

확실하지 않음이 링크가 도움이된다 : (http://emberjs.com를 /api/data/classes/DS.Adapter.html). 당신이 docs에 따라 상점에 할당해야하는 맞춤 어댑터를 만드는 것처럼 보입니다 (제가 완전히 여기에있는 경우 사과드립니다!). – Sarus

답변

1

당신은 당신이 시도 원합니까 개체의 어떤 종류의 가게 말해야 :

App.VideosRoute = Ember.Route.extend({ 
    model: function() { 
     return this.store.find('video'); 
    } 
});