witoldsz/angular-http-auth — pull request #70 by christianrondeau (2014-06-04 01:54:17+00:00)
Title: Use confirmLogin and cancelLogin from broadcasted event rather than depending on a service

Hi!

Here's the pull request for issue #57; I put together an implementation with as few changes and bells and whistles as possible. Let me know what you think. I also updated the README.md file, though again I didn't want to rewrite what didn't need to. It might be worth it though.

One last comment; I encourage you to use grunt or gulp to run jshint and maybe a few unit tests; it makes it easier to ensure someone doesn't break anything :)

Here is a simple example where myLoginService.promptLogin() is a custom service that shows a modal window and returns a promise.

```javascript
$scope.$on('event:auth-loginRequired', function(e, args) {
myLoginService.promptLogin().then(
function() {
args.confirmLogin();
},
function() {
args.cancelLogin();
});
});
```

I'll let you (or someone else) peer review the commit, especially the function names and event names. Since we're breaking backward compatibility, it would be a good timing to review them :) Let me know what you think!