I have a simple angular form
<form name="myForm" ng-controller="myFormController"></form>
and need to call $setPristine() to myForm in myFormController. What is the best way to initialize this form as a $scope variable?
I tried $scope.myForm.$setPristine(); but it gave me:
Cannot read property '$setPristine' of undefined
Thanks in advance.
EDIT From the docs:
name (optional) Name of the form. If specified, the form controller will be published into related scope, under this name.
That means you can access it in a controller, but how?