title: angular.js : how to pass ngclick from original dom to directive's dom?
body: <p>Hi there I have this "confirmable" button directive which I am working on, </p>
  
  <p>The html code that will trigger the directive 'confirmable'</p>
  
  <pre><code>      &lt;span confirmable ng-click='users.splice($index,1)'&gt;&lt;/span&gt;
  </code></pre>
  
  <p>the directive: (coffeescript)</p>
  
  <pre><code>  angular.module('buttons',[])
  
    .directive 'confirmable', () -&gt;
      template: """
        &lt;button class='btn btn-mini btn-danger'&gt;
          Destroy
        &lt;/button&gt;
      """
      replace: yes
  </code></pre>
  
  <p>So the end result I'd like to see generated with this directive is</p>
  
  <pre><code>      &lt;button class='btn btn-mini btn-danger' ng-click='users.splice($index,1)'&gt;
          Destroy
        &lt;/button&gt;
  </code></pre>
  
  <p>So far I got it to work with a linking function inside the directive</p>
  
  <pre><code>  angular.module('buttons',[])
  
    .directive 'confirmable', () -&gt;
      template: """
        &lt;button class='btn btn-mini btn-danger'&gt;
          Destroy
        &lt;/button&gt;
      """
      replace: yes
      link: (scope, el, attrs) -&gt;               &lt;---------- linking function
        $(el).attr 'ng-click', attrs.ngClick
  </code></pre>
  
  <p>But I've gone through the directive documentation again, and found the scope property with the =, @, &amp; operators but I am really unsure if they are what I need. Then there's this transclude properties which I still need to understand but at the moment doesn't seem to be helpful either. So while my linking function does the trick for now, but I thought I should ask to see if angular provides a more elegant solution.</p>
  
  <p>Thanks!</p>