Ember.js历史转换后不起作用 [英] Ember.js history not working after transitionTo

查看:96
本文介绍了Ember.js历史转换后不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请参阅这个运行良好的JSBin: http://jsbin.com/acUm/20

please see this functioning JSBin: http://jsbin.com/acUm/20

这是我正在处理的行为。如果我键入门罗过滤列表,然后点击浏览器返回按钮,我希望Ember处理路由并激活所有患者的请求。相反,它似乎什么都不做。这是特别混乱的,因为后退按钮似乎在其他领域工作。

Here is the behavior I am working on. If I type 'Monroe' to filter the list down and then hit the browser back button, I expect Ember to process the route and fire the request for all patients. Instead it appears to do nothing. This is especially confounding since the back button seems to work in other areas.

也许我已经不正确地设置了这个转换?或者这是一个Ember.js错误?

Perhaps I have set up this transition improperly? Or is this an Ember.js bug?

推荐答案

当您转换到路由时,最好使用小孩路由

When you transition to a route, it's a good idea to use the childest route in the hierarchy.

在你的情况下,你有这样的:

In your case you have this:

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

默认情况下为该资源创建路由索引,因此您有 patients.index
但是你的过渡到患者,它不是最小的。

By default is created a route index for that resource, so you have the patients.index. But your transition goes to patients and it isn't the childest.

所以要纠正这个,我已经改变了你的样本,使用 PatientsIndex [Controller,Router等] 而不是病人[控制器,路由器等]

So to correct this, I have changed your sample to use PatientsIndex[Controller,Router etc], instead of Patients[Controller,Router etc].

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

这篇关于Ember.js历史转换后不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆