嵌套路由:断言失败:URL“/ posts.index”与应用程序中的任何路由都不匹配

时间:2013-12-19 21:12:32

标签: javascript ember.js

我正在玩Ember,我有一个简单的页面,我尝试定义这样的路线:

App.Router.map(function() {
  this.resource('posts', function() {
    this.route('new');
  });
});

此代码完全从here复制。当我尝试在浏览器中打开index.html#posts时,出现此错误:

Assertion failed: The URL '/posts.index' did not match any routes in your application

我正在运行Ember 1.2.0。

1 个答案:

答案 0 :(得分:1)

您还必须定义帖子索引路径

App.PostsIndexRoute = Em.Route.extend({

});

或只是帖子路线

App.PostsRoute = Em.Route.extend({

});

http://emberjs.jsbin.com/ENEHUQI/1/edit