簡體   English   中英

型號不適用於新的Ember數據升級

[英]Models not working with the new Ember-data upgrade

我已經設置了Ember on Rails進行一些練習,最初收集了我模型中的數據,但是在安裝了新的捆綁軟件之后,不再使用我模型中的數據。 我認為是因為安裝了新的Ember-data gem。

在這里提交

編碼

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

App.Person.FIXTURES = [
 {
   id:1,
   name: 'Tom'
 },
 {
   id: 2,
   name: 'Giorgio'
 },
 {
   id: 3,
   name: 'Laura'
 }
];

<script type="text/x-handlebars" data-template-name="about">
  <ul>
    {{#each person in model}}
      <li>{{person.name}}</li>
    {{/each}}
  </ul>
  About 
</script>



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

如何使我的模型在About視圖中再次起作用?

我不確定為什么您有2個App.About.Route,但是請嘗試一下

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM