Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Allow loginConfirmed and loginCancelled from broadcasted event #57

Open
christianrondeau opened this issue Feb 14, 2014 · 9 comments

Comments

@christianrondeau
Copy link

It's a breaking change but one I would personally love :)

Instead of referencing authService, you could provide the loginConfirmed and loginCancelled callbacks directly on the event arguments of the broadcast. That would remove a dependency. Example:

$rootScope.$on('event:auth-loginRequired', function (args) {
    signin().then(
        function() {
            args.loginConfirmed();
        },
        function() {
            args.loginCancelled();
        });
});

Let me know if you'd like me to suggest a pull request!

@jameskleeh
Copy link
Contributor

+1

@witoldsz
Copy link
Owner

witoldsz commented May 5, 2014

This looks nice, I wish I did not consider it earlier. But now, what can I do? Should I break the API compatibility and force every one to update theirs code? Maybe once AngularJS 2.0 arrives, the new version of this module could apply this pattern, I like it.

@jameskleeh
Copy link
Contributor

Introducing a new major version doesn't force others to update to it

@witoldsz
Copy link
Owner

witoldsz commented May 5, 2014

Yes, but I don't feel this one little convenience is enough to release a new major version.

@christianrondeau
Copy link
Author

I can still provide a pull request if you are interested in releasing a new version.

Another approach would be to create a second event; it bloats the code but won't break existing implementations.

What do you think?

@witoldsz
Copy link
Owner

witoldsz commented May 6, 2014

Pull request does not hurt :) You can open one, I won't pull it now, but I will keep an eye on it, so when new major version would be prepared, I could merge it.

@christianrondeau
Copy link
Author

With the breaking change or the new event? Even though I prefer the breaking change, it's up to you.

@witoldsz
Copy link
Owner

witoldsz commented May 7, 2014

Braking change I guess, no need to keep them both...

christianrondeau added a commit to christianrondeau/angular-http-auth that referenced this issue Jun 4, 2014
…an argument to the 'event:auth-loginRequired' broadcast
christianrondeau added a commit to christianrondeau/angular-http-auth that referenced this issue Jun 4, 2014
@christianrondeau
Copy link
Author

I just made available a pull request for this (#70). I think it needs a peer review, otherwise feel free to pull if you're happy with it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants