title: Angular Forms: Set all fields untouched, not dirty and valid
body: <p>I would like a function to set all fields untouched, not dirty and valid on a given form.I need that so i can display errors properly.Here is what i have tried.It does not work for some reason.</p>
  
  <pre><code>angular.forEach($scope.LoginForm, function (input) {
              if (input.hasOwnProperty('$viewValue'))
                input.$setPristine();
          });
  </code></pre>
  
  <p>As you can see, a ngmodel on a form alwyas has a property called $viewValue.</p>
  
  <p>I am getting the following error.</p>
  
  <p>TypeError: Cannot read property 'hasOwnProperty' of undefined</p>