Angular js- Simulate browser back/forward button disabling Angular js- Simulate browser back/forward button disabling angularjs angularjs

Angular js- Simulate browser back/forward button disabling


The $location service may be of use to you. https://docs.angularjs.org/api/ng/service/$location#state

Also, I'm not sure how compatible it would be with angular, but you may want to look at https://github.com/browserstate/history.js/


I believe this should work for you.

if(typeof window.history.forward!=='function'){  $scope.abcService.enableForwardButton = false;}

When you can navigate forward then typeof window.history.forward is 'function' when you cannot then it is 'undefined'