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.
We currently have $error as part of ngModelController and formController to represent errors when validations have failed on certain form inputs.
This is already super powerful and covers almost all use cases, however, recently when I was reviewing an application a new use case occurred.
Motivation
Some inputs of a form of the application allow any value but should display a warning if the value is a different type of what it is supposed to be.
Example:
A text input for phone number. The user is allowed to type in numbers and letters and the model gets updated, but should get a warning that displays information that it might be a wrong value.
Proposal
Introduce $warning next to $error on ngModelController/FormController to take advantage of the same mechanisms we use to display errors (ngMessages, etc.) except that the model gets updated regardless of if warning occurs or not.
Definitely a use case.
I wonder if we can make this more generic, though. Add warning and next thing you know people want hint, info etc. ;)
A generic "info" property or similar on the model could help. Validators would still work like before, but if they pass, they would be added to the info array and be accessible there. Validators should also be able to return metadata information (hint texts, type) etc., that can be accessed by the template. The model would still be blocked from update if there's an error.
You seem to me to be addressing my problem. Hope this gets picked up soon.
In javascript there are three ways of notifying the user: alarm, confirm and prompt. If $error matches alarm then $warning or $info would match confirm and prompt right?
I just had a scenario where this would be very handy. Basically we have the option to select an address via predictive address lookup. This gives us a unique ID matching the address, but just in case we allow the user to manually edit the fields. Now technically this does not make it invalid, but it would be nice to detect when they manually edit a field and display a warning to double check their address is correct or we might not be able to contact them by post.
It would have been nice to utilize the existing ng-messages to show this.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
We currently have
$error
as part ofngModelController
andformController
to represent errors when validations have failed on certain form inputs.This is already super powerful and covers almost all use cases, however, recently when I was reviewing an application a new use case occurred.
Motivation
Some inputs of a form of the application allow any value but should display a warning if the value is a different type of what it is supposed to be.
Example:
A text input for phone number. The user is allowed to type in numbers and letters and the model gets updated, but should get a warning that displays information that it might be a wrong value.
Proposal
Introduce
$warning
next to$error
onngModelController
/FormController
to take advantage of the same mechanisms we use to display errors (ngMessages, etc.) except that the model gets updated regardless of if warning occurs or not./cc @cburgdorf
The text was updated successfully, but these errors were encountered: