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.
You 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);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With