You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Sometimes, the client needs to communicate with the server in order to know wether the value of an input field is valid. For instance, usernames and e-mail addresses often need to be unique.
To allow this, I'd like to propose the following: When a $parsers element (from now on called a $parser, returns a value, we check wether it's a promise (both $q and native js promises). If it is, we apply a new 'processing' state to the form input. Then, then, when the resolve function is called, it receives the value you'd normally expect from a $parser.
I'm currently working on an implementation for this, but I'm new to the codebase, so it may take some time.
$asyncValidators don't solve the problem described in this issue. They only mark the input as valid/invalid but they don't modify $viewValue (example). Maybe this issue should be re-opened?
The real shortcoming is that the current angular API really only handles validation up until the user submits a form. Validation errors coming back after the user submitted the form have almost been entirely ignored. That's what angular-async-form aims to solve.
Here's a quick example of how it is used in a form:
In your doSomething handler, you can call the cb with a form wide error message, or error messages isolated to controls (which invalidate the form for subsequent submissions). Users must blur controls with server side validation errors before the form may be submitted again.
Activity
pkozlowski-opensource commentedon Feb 23, 2014
Hmm, I'm pretty sure I saw already an issue opened for this, can't find it atm, though...
frederikcreemers commentedon Feb 23, 2014
Maybe you're thinking about my topic in angular-dev? I posted about this a
while ago, but never got to implement it.
I searched for it, but couldn't find it.
2014-02-23 17:54 GMT+01:00 Pawel Kozlowski [email protected]:
btford commentedon Aug 28, 2014
This landed in the commits in the #8267 PR. Closing.
nikoudel commentedon May 20, 2015
$asyncValidators don't solve the problem described in this issue. They only mark the input as valid/invalid but they don't modify $viewValue (example). Maybe this issue should be re-opened?
jsdevel commentedon Jan 1, 2016
Check out https://github.com/kogosoftwarellc/angular-async-form. I believe it solves the real issue quite nicely.
The real shortcoming is that the current angular API really only handles validation up until the user submits a form. Validation errors coming back after the user submitted the form have almost been entirely ignored. That's what
angular-async-formaims to solve.Here's a quick example of how it is used in a form:
In your
doSomethinghandler, you can call thecbwith a form wide error message, or error messages isolated to controls (which invalidate the form for subsequent submissions). Users mustblurcontrols with server side validation errors before the form may be submitted again.