admin管理员组文章数量:1317915
I want to start my Backbone router at a specific action sometimes, different than the one that was navigated to. How can I change it so that when I call Backbone.history.start
it goes to a specific action/fragment other than the one in the URL?
Backbone.history.start
pushState: true
root: "/"
Maybe there's some option, or maybe there's a way for me to change the fragment before making that function call?
Thanks!
I want to start my Backbone router at a specific action sometimes, different than the one that was navigated to. How can I change it so that when I call Backbone.history.start
it goes to a specific action/fragment other than the one in the URL?
Backbone.history.start
pushState: true
root: "/"
Maybe there's some option, or maybe there's a way for me to change the fragment before making that function call?
Thanks!
Share Improve this question asked Oct 18, 2013 at 21:06 GarrettGarrett 11.7k20 gold badges86 silver badges129 bronze badges2 Answers
Reset to default 7Just pass "silent" option and than call "navigate":
Backbone.history.start({ silent: true });
router.navigate('test', { trigger: true });
In this case hash that was before you called Backbone.history.start will be ignored. Hash will be changed to 'test' and the same route function will be called.
The Backbone.history.navigate
will navigate to the route in the first argument, if the second argument is true
, it will also trigger the route function.
Backbone.history.navigate('users/sam', true);
本文标签: javascriptBackbonehistorystart with a specific fragmentStack Overflow
版权声明:本文标题:javascript - Backbone.history.start with a specific fragment - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742023049a2415035.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论