title: Add ng-required attribute dynamically in directive
body: <p>Currently I have defined my custom directive:</p>
  
  <pre><code>.directive('foo', function () {
    return {
      restrict: 'A',
      require: 'ngModel',
      link: function (scope, element, attributes, ngModel) {
  
        scope.isRequired = function () {
          return !attributes.disabled; // more complicated test
        };
  
      }
    };
  }])
  </code></pre>
  
  <p>And it's used like:</p>
  
  <pre><code>&lt;input name="a" type="text" foo ng-required="isRequired" /&gt;
  &lt;input name="b" type="text" foo ng-required="isRequired" /&gt;
  &lt;input name="c" type="text" foo ng-required="isRequired" /&gt;
  </code></pre>
  
  <p>Is it possible to define <code>ng-required</code> attribute in the directive instead of linking the <code>isRequired</code> method in the template ?</p>
  
  <p>Expected result:</p>
  
  <pre><code>link: function (scope, element, attributes, ngModel) {
  
    element.attr('ng-required', function () {
      return !attributes.disabled; // more complicated test
    });
  
  }
  </code></pre>
  
  <p>However this function is not called, <code>ng-required</code> is not applied.</p>