2013-08-22 208 views
0

后不能正常工作,请参阅此功能JSBin:http://jsbin.com/acUm/20Ember.js历史transitionTo

这里是我工作的行为。如果我输入'Monroe'来过滤列表,然后点击浏览器后退按钮,我希望Ember能够处理路线并向所有患者发出请求。相反,它似乎什么都不做。由于后退按钮似乎适用于其他区域,因此特别混乱。

也许我设置了这个过渡不当吗?或者这是一个Ember.js错误?

+0

UPDATE:http://jsbin.com/acUm/28/edit?html,js,output。在搜索并加载'/ filtered /:last_name'路线后,甚至没有linkTo帮助程序工作。 WTF? – jasongonzales

回答

2

当你转换到路由时,在层次结构中使用childest路由是一个好主意。

你的情况,你有这样的:

this.resource('patients', { path: '/' }, function() { 
    // this is created for you 
    // this.route('index'); 
    this.route('filtered', { path: '/filtered/:last_name' }); 
}); 

默认情况下,创建了该资源的路径标识,让你有patients.index。 但是你的转换转到patients,它不是最简单的。

所以要更正此问题,我已将您的示例更改为使用PatientsIndex[Controller,Router etc]而不是Patients[Controller,Router etc]

工作演示http://jsbin.com/acUm/24/edit

+0

干得好! Ember很简单,如果你明白它是如何要你做的事:) – jasongonzales

+0

@Marcio Junior有没有其他的方式来解决问题,而不是使用索引路线? –