Skip to content

Instantly share code, notes, and snippets.

@heavysixer
Created May 21, 2015 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heavysixer/47dd0e873af7dd76c647 to your computer and use it in GitHub Desktop.
Save heavysixer/47dd0e873af7dd76c647 to your computer and use it in GitHub Desktop.
Backbutton Directive.
(function() {
'use strict';
/**
* @ngdoc directive
* @name hsBackButton
* @module humansized.directives.backButton
* @restrict A
*
* @description
*
* A directive that goes backwards through the browser's history
*
* @usage
*
*/
var hsBackButton = function($window) {
return {
restrict: 'A',
link: function($scope, $element) {
$element.on('click', function() {
$window.history.back();
});
}
};
};
angular.module('humansized.directives')
.directive('hsBackButton', ['$window', hsBackButton]);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment