title: Showing a system error on a form after submitting via AJAX
body: <p>I'm trying to find the best way in Angular to invalidate a form not due to a specific element, but due to a system-level error AFTER submission via AJAX. For example, you could put in a valid email and password (both good strings), press submit, and find out there is a system error that should trigger a generic error message on the form. Since this isn't tied to anything in the data model, what is the best way I can generically call the form 'invalid'?</p>
  
  <pre><code>&lt;form name="loginForm" class="loginForm" ng-submit="loginSubmit(loginForm)"&gt;
      &lt;div class="form-group"&gt;
          &lt;label for="exampleInputEmail1"&gt;Email address&lt;/label&gt;
          &lt;input type="email" name="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email" ng-model="login.email" required&gt;
          &lt;span class="error" ng-show="loginSubmit.email.$error"&gt;Required!&lt;/span&gt;&lt;br&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          &lt;label for="exampleInputPassword1"&gt;Password&lt;/label&gt;
          &lt;input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password" ng-model="login.password" minlength="8" required&gt;
      &lt;/div&gt;
      &lt;button type="submit" class="btn btn-default"&gt;Log In&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and...</p>
  
  <pre><code>    ngModule.controller('LoginController', function($scope, $location) {
  
          $scope['login'] = {};
  
          $scope['loginSubmit'] = function(form) {
  
              var loginPromise = myAsyncLoginFuncYouCanAssumeWorks();
  
              loginPromise.done(function(){
  
                  $location.path('/');
  
              });
  
              loginPromise.fail(function() {
  
                  //how best to trigger a generic error in the form here?
  
              });
  
          };
  
      });
  </code></pre>
  
  <p>As you can see, I'd like to trigger some form-wide error state after submission. It really could be as simple as adding an invalid form class to the form, but again, I'd like to know the purest Angular way to do this.</p>