EmberJS - didInsertElement用于以前显示的视图 [英] EmberJS - didInsertElement for previously displayed view
问题描述
是否有一个事件,我的视图可以挂钩,每次显示时都会被调用? / p>
我的路线看起来像这样
App.Router.map function(){
this.resource(parent,{path:/ parent},function(){
this.resource(child,{path:/ child}) ;
});
});
所以当我在子视图中调用:
this.transitionTo('parent')
父视图不会触发'didInsertElement'。
我发现我可以使用 setupController在路线中每次呈现路线时,让我知道的路线中的
我知道这不是最好的解决方案,但到目前为止,这是最可靠的。
I have a flow with multiple pages and when I use 'transitionTo' to go back to a route/view that has already been displayed, it's 'didInsertElement' method is not called. (it was fired the first time the view was displayed, though)
Is there an event that my view can hook into that will be called every time it is displayed?
My routes look something like this
App.Router.map(function() {
this.resource("parent", { path: "/parent" }, function() {
this.resource("child", { path: "/child" });
});
});
So when I'm in the child view and call:
this.transitionTo('parent')
The parent view does not fire 'didInsertElement'.
I found that I can use setupController
in the routes to let me know each time the route is rendered. I know it's not the best solution, but so far, it is the most reliable.
这篇关于EmberJS - didInsertElement用于以前显示的视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!