angularjs - How to access form validation properties in the controller -
As seen here:
For example, how to use template var: < / P>
{{myForm.input. $ Validate}} In the controller?
$ scope.myForm.input. $ Valid does not do
You save $ $ to $ May add scope .myForm.input. Valid $. Working here.
& lt; Script & gt; Angular.module ('test', []). Controller ('formController', ['$ scope', function ($ radius) {$ scope.myForm = {} $ $. $ Watch ('myForm.input. $ Valid', function (Newell) {$ scope.valid = NewVal;});}]); & Lt; / Script & gt; & Lt; Form name = "myForm" ng-controller = "formController" & gt; Email: & lt; Input type = "email" name = "input" ng-model = "text" required & gt; {{MyForm.input. $ Valid}} {{valid}} & lt; / Form & gt;
Comments
Post a Comment