Ideally use a simple directive to keep controllers free from redundant $window
app.directive('back', ['$window', function($window) {
return {
restrict: 'A',
link: function (scope, elem, attrs) {
elem.bind('click', function () {
$window.history.back();
});
}
};
}]);
Use like this:
<button back>Back</button>