2

I am using ng-routing in application in angularjs. I have my own back button. I want to go back to previous page from where I have redirected to this page? Kindly help me?

1

2 Answers 2

3

You can use history.back() on click of your back button. this will redirect to your previous page using browser's history.

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

Comments

1

A simple directive for that

app.directive('historyBackward', ['$window', function($window) { return { restrict: 'A', link: function(scope, elem, attrs) { elem.bind('click', function() { $window.history.back(); }); } }; }]); 

In your HTML

<button history-backward>back</button>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.