I am learning how to handle forms with angularjs. As far as I have understood, it is reasonable to create a component to handle custom input elements. Please do correct me if it is not a good practice.
Without using a component an input element like:
<input type="text" name="field" data-ng-model="myField" required />
can be validated via a model binding and the boolean method:
myField.$valid
Now, if I define a component using the following code:
{
myModel: '<',
template: '<input type="text" name="field" data-ng-model="$ctrl.myModel" required />'
}
why a call like:
$ctrl.myModel.$valid
is not parsed? Which logic step am I missing?
Thanks in advance for your time!
[formName].[inputFieldName].$valid
I think for this you need to give the name reference for validation.