title: How to use ng-change function in directive?
body: <p>I am trying to make auto-complete, for this I am using tags-input. Directive name is my-directive, Inside controller I am trying to call <code>selectUser</code> function, but it is not working. </p>
  
  <p>In auto-complete, you have to type 4 letters, like: john, then I will show options..</p>
  
  <p><strong>View</strong></p>
  
  <pre><code>  &lt;body ng-app="myApp" ng-controller="appCtrl"&gt;
      &lt;my-directive  apipoint="customerApi" modeldisplay="tags.selected"  ng-model="tags.selected" change="selectUser(tags.selected)"&gt;&lt;/my-directive&gt;
    &lt;/body&gt;
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>app.controller("appCtrl", function($scope){     
    $scope.tags = {};
    $scope.tags.selected = [];
    $scope.customerApi = ['tags.json'];
    $scope.selectUser = function(foo)  {
      $scope.aux = foo;
      alert();
    };
  });
  </code></pre>
  
  <p><strong>Directive</strong></p>
  
  <pre><code>app.directive("myDirective", ['$http',function($http){
    return {
      restrict: "E",
      template : 'Here Use tag-input: &lt;tags-input ng-model="modeldisplay"'+
       'ng-change="change(modeldisplay)"&gt;'+
       '&lt;auto-complete source="loadTags($query)"&gt;&lt;/auto-complete&gt;'+
       '&lt;/tags-input&gt;',
      require: 'ngModel',
      scope : {
        modeldisplay: "=",
        apipoint: "="
      },
      link : function(scope, element, attrs, ctrl){
        scope.loadTags = function(query) {
           return $http.get(scope.apipoint[0]);
        };
        scope.change = function(item){
          ctrl.$setViewValue(item);
        }
      }
    };
  }]);
  </code></pre>
  
  <p>**DEMO/Now Working **</p>
  
  <p><a href="http://plnkr.co/edit/f7MZuNaDWIFatLPZobhN?p=preview" rel="nofollow">Plunker Demo</a></p>
  
  <p>One more thing Is my approach I right?, Reason Behind is that, In Angularjs View, I want to use auto-complete directive oneline, I want to make it as generic approach...</p>