Created
May 21, 2015 01:09
-
-
Save heavysixer/47dd0e873af7dd76c647 to your computer and use it in GitHub Desktop.
Backbutton Directive.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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