title: How to manually change the $error values for input tags - Angularjs
body: <p>I am submitting a form via the angular $http and I want to give an error if the user bypassed the angularjs validation. I want to use the same error tag as if they didn't bypass the validation, <code>userForm.name.$invalid &amp;&amp; !userForm.name.$pristine</code> how can I manually set this value  ?</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>  &lt;body&gt;
      &lt;form ng-controller="UserController" ng-model="userForm" name="userForm" ng-submit="createUser()"&gt;
  
        &lt;legend&gt;Create User&lt;/legend&gt;
  
        &lt;label&gt;Name&lt;/label&gt; 
        &lt;input type="text" id="name" name="name" ng-model="user.name" placeholder="User Name" required&gt;
        &lt;!-- HERE IS WHERE THE ERROR SHOWS --&gt;
        &lt;p ng-show="userForm.name.$invalid &amp;&amp; !userForm.name.$pristine"
  
        &lt;button class="btn btn-primary"&gt;Register&lt;/button&gt;
  
      &lt;/form&gt;
    &lt;/body&gt;
  </code></pre>
  
  <p><strong>ANGULAR JS</strong></p>
  
  <pre><code>  $http({
      method : 'POST',
      url : '/create',
      data : user,
      headers : {
        'Content-Type' : 'application/x-www-form-urlencoded'
      }
    })
    .success(function(data) {
      // I want to do something like this 
      name.$invalid = true;
      name.$pristine = false;
    });
  </code></pre>
  
  <p>I want to do something like what is in the <code>success</code> function. Therefore it will show the error message. </p>