title: Send an event using $emit from directive to controller
body: <p>I'm trying to send an event when an item gets selected, from directive to controller using <code>$emit</code>. I've two update functions for organizations and another for people. My directive should specify which event should emit.</p>
  <p>Here is my update functions:</p>
  <p>// For organization</p>
  <pre><code> $scope.updateOrgs = function(selectedVal) {
             
   }
  </code></pre>
  <p>// For people</p>
  <pre><code>$scope.updatepeople = function(selectedVal, type) {
  
  }
  </code></pre>
  <p>When it is people my directive should raise an emit event for <code>updatepeople ()</code>, if it was org it should raise <code>updateorg()</code>.</p>
  <p>My directive looks like:</p>
  <pre><code>.directive('search', function ($timeout) {
      return {
          restrict: 'AEC',
          scope: {
              model: '=',
              searchobj: '@',
          },
          link: function (scope, elem, attrs, index) {
              scope.handleSelection = function (selectedItem) {
                  scope.model = selectedItem;
                  scope.searchModel=&quot;&quot;;
                  scope.current = 0;
                  scope.selected = true;
                  $timeout(function () {
                      scope.onSelectupdate();
                  }, 200);
              };
              scope.Delete = function (index) {
                      scope.selectedIndex = index;
                      scope.delete({ index: index });
              };
              scope.Search = function (searchitem,event,searchobj) {
  //                   alert('item entered'+name)
                     scope.searching = searchitem;
                     scope.searchobject = searchobj;
                     scope.onSearch({ searchitem: searchitem , searchobj:searchobj}); 
              };
              scope.current = 0;
              scope.selected = true;
              scope.isCurrent = function (index) {
                  return scope.current == index;
              };
              scope.setCurrent = function (index) {
                  scope.current = index;
              };
          },
          controller: ['$scope','$element','$rootScope','SearchOrg', function($scope,$element,$rootScope,SearchOrg) {
              $scope.searchItem = function(filter,searchobj){
                  //alert('search'+searchobj);
                  SearchOrg().fetch({'filter': filter, 'searchType': searchobj}).$promise.then(function(value){
                      $scope.searchData = value.data;
                      console.info($scope.searchData);
                  },
                  function(err) { 
                  });
              }
          }],
          templateUrl: TAPPLENT_CONFIG.HTML_ENDPOINT[0] + 'home/genericsearch.html'
      }
  });;
  </code></pre>
  <p>HTML snippet</p>
  <pre><code>&lt;search searchobj=“tei-org” selectedItems=“arrayofIds” search-id=”someidtoIdentify”/&gt; 
  </code></pre>
  <p>How can I do this both functions are in different controllers, and also I need to send parameters from directive to the controller using <code>$emit</code>?</p>