title: $scope.formName.fieldName.$setValidity is not working
body: <p>I would like to set invalid with angular when firstname is equals to lastname and change the color using styles to red.</p>
  
  <p><a href="http://jsbin.com/japir/2" rel="nofollow">http://jsbin.com/japir/2</a>    </p>
  
  <pre><code>function RegoController($scope) {
    $scope.app = {
      firstName: "Saroj"
    };
  
    $scope.$watch("app.lastName", function(newVal, oldVal) {
      if (!!$scope.app.lastName &amp;&amp; !!newVal)
        if (angular.lowercase($scope.app.firstName) === angular.lowercase(newVal)) {
          debugger;
          $scope.form.inputLastName.$setValidity("sameName", false);
        }
  
    });
  }
  
  &lt;body ng-app&gt;
    &lt;div class="container" ng-controller="RegoController"&gt;
      &lt;div class="col-lg-4"&gt;
        &lt;form name="form"&gt;
          &lt;div class="form-group"&gt;
            &lt;label for="inputFirstName"&gt;First Name&lt;/label&gt;
            &lt;input id="inputFirstName" class="form-control" type="text" ng-model="app.firstName" placeholder="Enter your firstname" required ng-minlength="3" ng-maxlength="20" /&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
            &lt;label for="inputLastName"&gt;Last Name&lt;/label&gt;
            &lt;input id="inputLastName" class="form-control" type="text" ng-model="app.lastName" placeholder="Enter your last name" required ng-minlength="3" ng-maxlength="20" /&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
            &lt;label for="inputEmail"&gt;Email&lt;/label&gt;
            &lt;input id="inputEmail" class="form-control" type="email" ng-model="app.email" placeholder="Enter your email" required /&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
            &lt;input type="submit" class="btn btn-primary" value="Save" /&gt;
          &lt;/div&gt;
        &lt;/form&gt;
        {{app}}
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>