title: Angular directives do not emit 'viewContentLoaded' event
body: <p>I wrote a 'light-gallery' directive. It needs <code>jquery.lightgallery.js</code> plugin to initialize <code>$.fn.lightGallery()</code> functions which must do after the directive template compiled and loaded.</p>
  
  <p>However, Angular directives do not emit 'viewContentLoaded' event in the <code>link</code> function. So I want to ask how I can know when the directives templates compiled and loaded?</p>
  
  <p>Now I used <code>$timeout</code> to listen for a scope value if it has been compiled. When the scope value has been compiled, the <code>oncompiled</code> function can be run. Look:</p>
  
  <pre><code>myApp.directive("light-gallery", function(){
    return {
      restrict: "E",
      scope: {},
      replace: true,
      template: '&lt;div compiled="{{compiled}}"&gt;&lt;/div&gt;',
      link: function(scope, elem, attrs){
        var onCompiled = function(){
          $("#lightgallery").lightGallery();
        };
  
        var recur = function(){ 
          // when the attr `compiled` values `true`
          // it means template compiled and loaded
          if("true" === elem.attr("compiled")){
            onCompiled();
          }else{
            setTimeout(recur, 100);
          }
        };
        recur();
  
        // to tell template compiled
        scope.compiled = true
      }
    }
  })
  </code></pre>
  
  <p>Is that method right and regular? Or how should I write regularly?</p>
  
  <p>Thanks!</p>