2013-10-16 4 views
0

엠버 .js + 엠버 데이터를 학습하십시오. 나는 마지막 Ember.js 1.0 엠버 데이터 1.0.0 베타 2를 사용 http://locahost:3000간단한 엠버 데이터 작업을 할 수 없습니다.

var App = Ember.Application.create(); 

App.Store = DS.Store.extend({ 
    revision: 11, 
    url:"http://localhost:3000" 
}); 
App.Client = DS.Model.extend({ 
    shortName: DS.attr('string'), 
    longName: DS.attr('string') 
}); 
var clients = this.store.find('client'); 
console.log(clients); 

에서 API 엔드 포인트가 있습니다. 오류 받기

Uncaught TypeError: Cannot call method 'find' of undefined

ember-data에 대한 업데이트 된 자습서가 있는지 궁금합니다. 이 자습서 : http://twbrandt.github.io/2013/02/22/Ember-Data-Quick-Start-Guide/은 구식입니다.

+0

저장소에서 'revision'을 삭제해야합니다. Ember Data 1.0.0-beta1부터 사용되지 않습니다. – Pavlo

답변

0

어떤 경로에서는 this.store을 사용해야합니다. 예 :

var App = Ember.Application.create(); 

App.Store = DS.Store.extend({ 
    revision: 11, 
    url:"http://localhost:3000" 
}); 
App.Client = DS.Model.extend({ 
    shortName: DS.attr('string'), 
    longName: DS.attr('string') 
}); 

App.IndexRoute = Ember.Route.extend({ 
    model: function() { 
     this.store.find('client').then(function(clients) { 
      console.log(clients); 
     });     
    } 
}); 
관련 문제