Skip to content

Instantly share code, notes, and snippets.

@brianbroken
brianbroken / directives.js
Created May 24, 2017 05:56 — forked from jakemmarsh/directives.js
AngularJS directive to create a functional "back" button
app.directive('backButton', function(){
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.bind('click', goBack);
function goBack() {
history.back();
scope.$apply();