只是想知道为什么我的路由器没有方法导航?我的new App.Router;
正确调用。在我看来,我试着打电话给我的索引视图,像这样:骨干路由器没有方法导航
addTrip: function(e){
e.preventDefault() ;
//Adding to collection
var newTrip = this.collection.create({
title: this.$('#new_trip #title').val(),
where: this.$('#new_trip #where').val(),
desc: this.$('#new_trip #desc').val(),
rating: this.$('#new_trip .active').text()
}, { wait: true }) ;
if(newTrip.validationError){
this.errorReport(newTrip.validationError) ;
}
this.clearForm() ;
//Navigate to home route
App.Router.navigate('', true) ;
}
我得到的Chrome浏览器开发工具以下错误:
Uncaught TypeError: Object function(){ return parent.apply(this, arguments); } has no method 'navigate'
我甚至试着打从控制台导航和它似乎也没有工作。
我在做什么错?
你怎么声明'App.Router'? – neebz 2013-03-25 10:20:06