Open rainoxu opened 11 years ago
It sounds possible and useful! would you like to open a PR?
I have a personal project running during my spare time, maybe I could not send the PR within a short period, but I will try my best :)
My simple workaround on this
(Circa Line 213 of mobile-nav.js)
nav.back = function() {
if (navHistory.length > 0) {
var previous = navHistory[navHistory.length-1];
$location.path(previous.path());
nav.onRouteSuccess = function() {
navHistory.pop();
nav.next = previous;
navigate(nav.next, nav.current, true);
};
return true;
}
else {
nav.go('', false, true);
}
return false;
};
Or: if there is no navHistory, nav.go to path '' using reverse animation.
It has been really nice, this is not a serious problem: take your demo as an example, if a user visits http://ajoslin.github.io/angular-mobile-nav/#/two directly, the go-back button will not repond any action -- of course, the stack of history has no any data for his visiting. while the route config has all data deveoper set, so in the case, go-back button with the respond function ( $navigate.back() ) may action acording to the analysis of route config, how do u think this idea~