admin管理员组文章数量:1414628
Using the latest Meteor and Iron Routing, how do I simply "go back" to the previous route? I feel silly even asking, because it seems this would be a main feature of Iron Routing..
For instance, say I went to "/contacts" from "/posts" and then I wanted to "go back" with my app's back button (not the browser button, though this does what I'd like this functionality to do) to /contacts again because that was the last route I was on. Is there not a one-line mand for this such as Router.back() that I could put in a global routes file whenever this is triggered?
This seems like it would be a very mon question, yet I can't find anyone that has asked it yet.. If so, forgive me and please direct me with a link.
Using the latest Meteor and Iron Routing, how do I simply "go back" to the previous route? I feel silly even asking, because it seems this would be a main feature of Iron Routing..
For instance, say I went to "/contacts" from "/posts" and then I wanted to "go back" with my app's back button (not the browser button, though this does what I'd like this functionality to do) to /contacts again because that was the last route I was on. Is there not a one-line mand for this such as Router.back() that I could put in a global routes file whenever this is triggered?
This seems like it would be a very mon question, yet I can't find anyone that has asked it yet.. If so, forgive me and please direct me with a link.
Share Improve this question edited May 15, 2015 at 0:54 Alex Pan 4,6418 gold badges37 silver badges45 bronze badges asked May 14, 2015 at 22:28 Matthew RobinsonMatthew Robinson 911 silver badge9 bronze badges 2- 1 window.history.back() ? ;) – juliancwirko Commented May 14, 2015 at 22:38
- Duplicate of stackoverflow./questions/27455173/…? – mwarren Commented May 14, 2015 at 22:44
2 Answers
Reset to default 6To go back in iron-router
, just use:
history.go(-1)
or
history.back()
Both of these are supported by iron-router
.
FooController.events({
'click [data-action=back]' : function () {
history.back();
}
});
Sorry, I was looking for something like the above code, which I put into [InsertGlobalControllerName]Controller.Events()
I wanted to make it a global event so a back button could work on all layouts. I figured it out, thanks for the help!
本文标签: javascriptReturn to previous path using MeteorJS and Iron RoutingStack Overflow
版权声明:本文标题:javascript - Return to previous path using MeteorJS and Iron Routing - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745178020a2646335.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论