title: Add attribute directive inside directive in angular
body: <p>I'm creating a validation directive in angular and I need to add a tooltip to the element the directive is bound to. </p>
  
  <p>Reading thru the web I found this solution setting a high priority and terminal to the directive, but since I'm using ngModel this doesn't work for me. This is what I'm doing right now:</p>
  
  <pre><code>return {
          restrict: 'A',
          require: 'ngModel',
          replace: false,
          terminal: true,
          priority: 1000,
          scope: {
              model: '=ngModel',
              initialValidity: '=initialValidity',
              validCallback: '&amp;',
              invalidCallback: '&amp;'
          },
          compile: function compile(element, attrs) {
              element.attr('tooltip', '{{validationMessage}');
              element.removeAttr("validator");
              return {
                  post: function postLink(scope, element) {
                    $compile(element)(scope);
                  }
              };
          },
  }
  </code></pre>
  
  <p>But it's not working for me. It throws the following error:</p>
  
  <blockquote>
    <p>Error: [$compile:ctreq] Controller 'ngModel', required by directive 'validator', can't be found!</p>
  </blockquote>
  
  <p>This is the HTML where I'm using the directive:</p>
  
  <pre><code>&lt;input id="username" name="username" data-ng-model="user.username" type="text" class="form-control" validator="required, backendWatchUsername" placeholder="johndoe" tabindex="1" &gt;
  </code></pre>
  
  <p>Any ideas on how can I solve this? </p>
  
  <p>Thanks.</p>