Reputation: 211
For the following code:
userType: <input name="input" ng-model="userType" required>
...
myForm.input.$valid = {{myForm.input.$valid}}
myForm.input.$error = {{myForm.input.$error}}
Both $valid
and $error
will be false
if the user touched the input and left it empty.
My question is:
$valid
and $error
? For example, $touched
has two states (touched or untouched). but what does it mean by "valid" or "invalid"?Upvotes: 0
Views: 1061
Reputation: 41387
$valid
simply return a boolean value depending on input is valid or not. But $error
provide detail information about the errors. For eg, if you couple of validations setup for a form and all of them are invalid, then the error will show the details description of all the errors.
Upvotes: 2