0

From my current path location i want to check my previous path location, how it is possible in angularjs

1 Answer 1

4

welcome to Stackoverflow. it would be nice if you could provide some further details on your question, as in its current state, your post is likely to get closed for showing no reaseach efforts etc. I strongly recommend to you the lecture of this nice 'How to ask' page

$scope.$on('$locationChangeStart',function(evt, absNewUrl, absOldUrl) {

    var hashIndex = absOldUrl.indexOf('#');

    var oldRoute = absOldUrl.substr(hashIndex + 2);

    History.lastRoute = oldRoute;

});

Service

globalModule.factory('History',function(){
  return{
    lastRoute: ''
  }
});

Will get you the url string (and therefore the name of the route) when HTML5Mode is false.

However, you are quite unclear about what you actually want to achieve. If you do need some other informations about the route, please tell us first which router you are using.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.