How can I reference the ng-form object from within my controller?
I have
<ng-form name="myForm">
</ng-form>
This code on the HTML page works fine
{{myForm.$valid}}
returning true or false as the case may be.
But what I want is to check the status of the form from within a funciton in the controller, for example before posting the data or retrieving data.
I have tried
$scope.myForm.$valid
but this doesn't exist. Neither is there any reference to the myForm
object in the $scope
itself.
The ng-form
is used within an ng-repeat
, all of which is within a normal HTML form object which is why it is being used.
As I said, the myForm.$invalid
is used to control the display/enabled controls within that form on the HTML page just fine.
Any ideas?