In Angular, how to get a form in $scope in controller?
<p>Having these two files:</p>

<p>HTML:</p>

<pre><code>&lt;form name="registrationForm" ng-submit="registerUser()"&gt;
   ...
&lt;/form&gt;
</code></pre>

<p>JS (inside the Angular controller):</p>

<pre><code>$scope.registrationForm.confirmPassword.$setValidity("PasswordsMatch", $scope.validation.doPasswordsMatch);
</code></pre>

<p>I get the error that <code>Cannot read property 'confirmPassword' of undefined</code></p>

<p>This leads me to believe that I have no access to the form <code>registrationForm</code> in the controller. Based on this (<a href="https://docs.angularjs.org/api/ng/type/ngModel.NgModelController" rel="nofollow">https://docs.angularjs.org/api/ng/type/ngModel.NgModelController</a>) I imagined that I should.</p>

<p>Other solutions that I've seen include passing the form to the controller when the form is submitted, but what I need to do (set custom validation) needs to happen way before that. </p>

<p>Other solution mentioned adding the controller to the form via <code>ng-controller</code> but that changed nothing. </p>

<p>EDIT: 
From the website above, is there a reason why in here (<a href="https://plnkr.co/edit/ZT0G6ajdbescT72qLKSU?p=preview" rel="nofollow">https://plnkr.co/edit/ZT0G6ajdbescT72qLKSU?p=preview</a>) $scope.myForm can be accessed, but only inside of the <code>$scope.setEmpty</code> function?</p>