title: How to display server errors in Angularjs with ng-messages
body: <p>I have have my angular app validating a sign-up form. On submit, the server also validates the data. I'm outputting error messages in angular using ng-messages. </p>
  
  <p>Here is a shortened version of my form, which works perfectly so far.</p>
  
  <pre><code>&lt;form name="signUpForm" novalidate data-ng-submit="attemptSignUp()"&gt;
      &lt;label for="firstName"&gt;First name&lt;/label&gt;
      &lt;input type="email" name="email" id="email" required data-ng-model="data.user.email" /&gt;
      &lt;div class="error" data-ng-messages="signUpForm.email.$error" data-ng-show="signUpForm.$submitted" data-ng-cloak&gt;
          &lt;p data-ng-message="required"&gt;Please provide your email&lt;/p&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The server verifies the email address is unique, and if not, returns a 422 error (from Laravel 5), with an array of errors.</p>
  
  <pre><code>[
      'email' =&gt; 'This email is already in use'
  ]
  </code></pre>
  
  <p>I'd like to merge in this, and any other messages sent back from the server into their relevant <code>ng-messages</code> block. Any idea how I could accomplish it?</p>