title: Calling a init function when a directive is loaded
body: <p>I have a simple directive that loads comments from a service(<code>commentsService</code>):</p>
  
  <pre><code>'use strict';
  
  angular.module('mean.rank')
      .directive('commentList', function(CommentsService, Global) {
          return {
              restrict: 'E',
              templateUrl:  'rank/views/comments-list.html',
              replace: false,
              link: function($scope, element, attrs) {
                  //accessing the ad info :  console.log("ADD  " , $scope.ad);
                  $scope.comments = [];
  
                  $scope.loadComments = function () {
                      console.log("in loadComments");
                      var adID = {};
                      adID.ad_ID = $scope.ad.nid;
                      console.log("calling services.getComments function with  " , adID.ad_ID);
                      CommentsService.getComments(adID.ad_ID)
                          .then(function (response) {
                              angular.forEach(comment in response)
                              $scope.comments.push(comment);
                          });
  
  
                  };
  
  
              }
          }
      })
  </code></pre>
  
  <p>The loaded comments should be loaded to the list(inside the <code>templateUrl</code>) using <code>ng-init</code> and then the service for loading (I will add the code if needed).</p>
  
  <pre><code>&lt;div ng-init="loadComments()"&gt;
      &lt;ul class="media-list comment-detail-list" &gt;
          &lt;li class="media" ng-repeat="comment in comments" &gt;
              &lt;article&gt;
                  &lt;div class="pull-left comment-info"&gt;
                      &lt;a href="#" class="author"&gt;{{ comment.author }}&lt;/a&gt;&lt;br /&gt;
                      &lt;time&gt;{{ comment.datePublished | date:"MM/dd/yyyy" }}&lt;/time&gt;
                  &lt;/div&gt;
                  &lt;div class="media-body"&gt;
                      &lt;div class="comment-body"&gt;
                          &lt;p&gt;{{ comment.comment }}&lt;/p&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/article&gt;
          &lt;/li&gt;
          &lt;li&gt;Debugger&lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The directive has in its scope the <code>loadCommets()</code> function but it is not triggered.
  Thank's for your help!</p>