2014-04-03 21 views
0

我使用EmberJS重新創建了TodoMVC,完成後我嘗試將ApplicationAdapter更改爲FirebaseAdapter。但隨後的應用程序停止工作,我得到這個錯誤:加載路徑時出錯:使用EmberJS和Firebase(emberFire)時出現undefined

Error while loading route: undefined 

下面是我使用

Ember  : 1.5.0 
Ember Data : 1.0.0-beta.7+canary.b45e23ba 
Handlebars : 1.3.0 
jQuery  : 2.1.0 

您可以在github 檢查出的代碼,但這裏的版本是一些文件內容。

有了這個代碼,它的工作原理

Todos.ApplicationAdapter = DS.FixtureAdapter.extend(); 

但是當我把它改成這樣,它停止工作,我得到的錯誤:

Todos.ApplicationAdapter = DS.FirebaseAdapter.extend({ 
    firebase: new Firebase('https://glaring-fire-8506.firebaseio.com') 
}); 

我有TodosController和TodoController,這是我的路由器文件

Todos.Router.map(function() { 
    this.resource('todos', { path: '/' }, function() { 
     this.route('active'); 
     this.route('completed'); 
    }); 
}); 

Todos.TodosRoute = Ember.Route.extend({ 
    model: function() { 
     return this.store.find('todo'); 
    } 
}); 

Todos.TodosIndexRoute = Ember.Route.extend({ 
    model: function() { 
     return this.modelFor('todos'); 
    }, 

    renderTemplate: function (controller) { 
     this.render('todos/index', { 
      controller: controller 
     }); 
    } 
}); 

Todos.TodosActiveRoute = Todos.TodosIndexRoute.extend({ 
    model: function() { 
     return this.store.filter('todo', function (todo) { 
      return !todo.get('isCompleted'); 
     }); 
    } 
}); 

Todos.TodosCompletedRoute = Todos.TodosIndexRoute.extend({ 
    model: function() { 
     return this.store.filter('todo', function (todo) { 
      return todo.get('isCompleted'); 
     }); 
    } 
}); 

編輯:當我加入待辦事項JSON對象火力地堡,它的窩國王應該如此。但我真的想要了解這個問題。

+0

嗨米爾科,你可以張貼的再現的錯誤代碼的小樣本?這是很好的禮儀,並顯示適當的盡職調查將其縮小到一個小樣本,而不是要求其他人克隆/構建/學習/排查你的應用程序,這可能會隨着您的修復而改變,甚至不能再現錯誤。 – Kato

+0

@Kato我也有這個問題。這是一個最小的jsbin。 http://emberjs.jsbin.com/kuyujohi/14/edit?js –

+0

創建一個單獨的問題,使其更加明顯。 –

回答