I have directive which is site header with back button and I want on click to go back to the previous page. How do I do it in the angular way?
I have tried:
You need to use a link function in your directive:
link: function(scope, element, attrs) { element.on('click', function() { $window.history.back(); }); }
See jsFiddle.