Created
September 23, 2014 16:59
-
-
Save cerkit/bd21e8219a4726915224 to your computer and use it in GitHub Desktop.
Basic Authentication with AngularJS - Login Dialog directive definition
This file contains hidden or 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
angular.module('app').directive('loginDialog', function () { | |
return { | |
templateUrl: 'app/templates/loginDialog.html', | |
restrict: 'E', | |
replace: true, | |
controller: 'CredentialsController', | |
link: function (scope, element, attributes, controller) { | |
scope.$on('event:auth-loginRequired', function () { | |
console.log("got login event"); | |
element.modal('show'); | |
}); | |
scope.$on('event:auth-loginConfirmed', function () { | |
element.modal('hide'); | |
scope.credentials.password = ''; | |
}); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment