Skip to content

Instantly share code, notes, and snippets.

@gabrysiak
Created August 14, 2014 19:38
Show Gist options
  • Save gabrysiak/85b40bcf231f3903d59a to your computer and use it in GitHub Desktop.
Save gabrysiak/85b40bcf231f3903d59a to your computer and use it in GitHub Desktop.
Angularjs - Back button directive
'use strict';
/* Directives */
angular.module('mean').directive('ngBack', [
function () {
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.bind('click', function () {
history.back();
scope.$apply();
});
}
};
}
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment