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:
<header class="title">
<a class="back" ng-class="icons"><img src="../media/icons/right_circular.png" ng-click="history.back()" /></a>
<h1>{{title}}</h1>
<a href="/home" class="home" ng-class="icons"><img src="../media/icons/53-house.png" /></a>
</header>
and this is the directive js:
myApp.directive('siteHeader', function () {
return {
restrict: 'E',
templateUrl: 'partials/siteHeader.html',
scope: {
title: '@title',
icons: '@icons'
}
};
});
but nothing happens. I looked in the angular.js API about $location but didn't find anything about back button or history.back()
.