title: unable to set validity on form
body: <p>I am trying to set a validation token "fooname" for a form through its controller, on the click of a button based on a condition.</p>
  
  <p>However it looks like form.$error.fooname is not getting set. {{form.$error.fooname}} is parsed as null.</p>
  
  <p>javascript:</p>
  
  <pre><code>angular.module('app', [])
  .controller('controller', ['$scope', function ($scope) {
      $scope.data={};
      $scope.data.validate=function () {
          if ($scope.data.name=="foo") {
              $scope.form.$setValidity("fooname",true);
          }
      };
  }]);
  </code></pre>
  
  <p>html:</p>
  
  <pre><code>&lt;form name="form" ng-controller="controller" 
  ng-submit="data.validate()" ng-init="form.$setValidity('fooname',false)" 
  novalidate&gt;
      &lt;input type="text" ng-model="data.name" name="name"/&gt;
      &lt;button type="submit"&gt;Submit&lt;/button&gt;&lt;br/&gt;
      {{data}}&lt;br/&gt;
      {{form.$error.fooname}}
  &lt;/form&gt;
  </code></pre>