[英]One of my `{{link-to}}` helpers is triggering a page reload. How can i figure out what is causing that page to reload completely?
The link is supposed to send me back to the index page /
from the /:id
path. 该链接应该使我从
/:id
路径返回到索引页面/
。 When I go back with the browser back button it does not reload the page and all is fine. 当我使用浏览器的“后退”按钮返回时,它不会重新加载页面,一切都很好。 The link it produces looks fine to me
href="/"
In other parts of the app for example going back to the index from /new
the same {{link-to}}
helper works fine. 它产生的链接对我来说似乎很好
href="/"
例如,在应用程序的其他部分,从/new
返回索引,相同的{{link-to}}
帮助程序也可以正常工作。
import Ember from 'ember';
import config from './config/environment';
var Router = Ember.Router.extend({
location: config.locationType
});
Router.map(function() {
this.route('conversations', {path: '/'}, function() {
this.route('new');
this.route('conversation', {path: '/:conversation_id'});
});
});
export default Router;
Back Button in conversation template: 对话模板中的“后退”按钮:
{{#link-to 'conversations'}}
Conversation Route: 对话路线:
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
return Ember.RSVP.hash({
conversation: this.store.find('conversation', params.conversation_id),
messages: this.store.find('message')
});
}
});
Conversations Index Route: 会话索引路由:
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return this.store.findAll('conversation');
}
});
Very simple solution to be able to find the problem: 能够找到问题的非常简单的解决方案:
In Chrome I activated "Preserve log upon navigation" to be able to see the Error. 在Chrome浏览器中,我激活了“导航时保留日志”以查看错误。 In the Settings of the Chrome Developer Tools.
在Chrome开发者工具的设置中。
Then I removed the problem which in my case was very simple by following the error: had no action handler for: back 然后,我通过遵循以下错误解决了这个问题,在我的情况下,该问题非常简单:没有操作处理程序用于:返回
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.