title: how to get the scope I bind to template inside directive link
body: <p>in html,i bind id inside directive:</p>
  
  <pre><code>&lt;my-customer data="id"&gt;&lt;/my-customer&gt;
  </code></pre>
  
  <p>in js:</p>
  
  <pre><code>angular.module('Main', [])
  .controller('Controller', ['$scope', function($scope) {
      $scope.id= 'divId';
  }])
  .directive('myCustomer', function() {
      return {
          restrict: 'E',
          scope: {
              data: '='
          },
          template: '&lt;div id="{{data}}"&gt;&lt;/div&gt;',
          link: function(scope,element,attrs){
              console.log(document.getElementById('divId'));
          }
      };
  });
  </code></pre>
  
  <p>It can show data in template,but console shows undefined because the template hasn't been loaded with data,how i get the dom after data has been loaded?
  Thank you!</p>
  
  <hr>
  
  <p>Using scope.$watch solve the problem:</p>
  
  <p>in html:</p>
  
  <pre><code>&lt;my-customer param="id"&gt;&lt;/my-customer&gt;
  </code></pre>
  
  <p>in js:</p>
  
  <pre><code>angular.module('Main', [])
  .controller('Controller', ['$scope', function($scope) {
      $scope.id= 'divId';
  }])
  .directive('myCustomer', function() {
      return {
          restrict: 'E',
          scope: {
              param: '='
          },
          template: '&lt;div id="{{param}}"&gt;&lt;/div&gt;',
          link: function(scope,element,attrs){
              scope.$watch('param',function(){
                  console.log(document.getElementById(param)); //get the dom
              });
          }
      };
  });
  </code></pre>