admin管理员组文章数量:1202580
I have a backbone application and i would require to know the router from which the current route is accessed. Is it possible?
For eg :-
I reach #/current
from #/test1
and also in another instance, from #/test1
.
So can i know through some way to detect the previous router hit?
Ive used :
Backbone.history.fragment
and this only gives me the current route accessed and not from which route.
I have a backbone application and i would require to know the router from which the current route is accessed. Is it possible?
For eg :-
I reach #/current
from #/test1
and also in another instance, from #/test1
.
So can i know through some way to detect the previous router hit?
Ive used :
Backbone.history.fragment
and this only gives me the current route accessed and not from which route.
Share Improve this question edited Sep 11, 2013 at 7:55 Gopesh 3,95011 gold badges39 silver badges53 bronze badges asked Sep 11, 2013 at 7:26 Roy M JRoy M J 6,9387 gold badges53 silver badges79 bronze badges1 Answer
Reset to default 23You can store your history in some array and do some manipulation with last/previous items.
var history = [];
this.listenTo(this, 'route', function (name, args) {
history.push({
name : name,
args : args,
fragment : Backbone.history.fragment
});
console.log(history);
});
本文标签: javascriptGet previous routerurl in backbone applicationStack Overflow
版权声明:本文标题:javascript - Get previous routerurl in backbone application - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738655345a2105106.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论