title: How to pass URL from controller to Directive in angularjs
body: <pre><code>angular.module('finalApp').controller('GetAgentDetailsCtrl', function ($scope,$rootScope){
      var vm=this;
      vm.url='api/agent/getAgentDetails';
  });
  
  
  'use strict';
  angular.module('finalApp').directive('homeHeader',['HttpService',function(HttpService){
      return{
          restrict:'E',
          templateUrl:'views/directives/header/header.html',
          controller: 'GetAgentDetailsCtrl',
          controllerAs: 'GetAgentDetlCtrl',
          link: function ($scope) {
              HttpService.get(GetAgentDetlCtrl.url).success(function (data) {
                  $scope.GetAgentDetlCtrl.defaultData = data;
                  console.log($scope.GetAgentDetlCtrl.defaultData);
              });
          }
      };
  }]);
  
  
  &lt;header ng-controller="GetAgentDetlCtrl"&gt;     
      {{GetAgentDetlCtrl.data}}
  &lt;/header&gt;
  
  &lt;main&gt;
  &lt;home-header&gt;&lt;/home-header&gt;
  &lt;/main&gt;
  </code></pre>