-
Notifications
You must be signed in to change notification settings - Fork 9
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
Support asynchronous validators #5
Conversation
Why would you need an async validation? Can you please give an example? |
@DAB0mB Great question! In my application I use the alanning:roles package, and in my ui-router routes definition, I have a resolve function that uses There are a couple ways of solving this problem. One is to change the logic in |
@canac maybe let's schedule a meeting on Hangouts? |
What happend with this PR ? |
@santiq Nothing, yet. Do you need this feature too? |
Yes, I need this too as I'm having the same issue |
If the validation function passed to $awaitUser returns a promise, the resolved value will be used to determine the user's validity.
There were merge conflicts, so I just rebased off of master to fix those. |
well, that took a while for us :) sorry about that @canac |
In my application, I need asynchronous validators. In this PR,
$awaitUser
now supports asynchronous user validation functions that return a promise. If the validation function returns a promise, the resolved value will be used to determine the user's validity. Also, if it returns a rejected promise, the rejected value will be used as the validation error object. Synchronous validators are still fully supported.