title: Pass variable from directive to controller
body: <p>I have this directive definition and want to pass <code>currentScriptPath</code> to the <code>TestController</code>.</p>
  
  <p>How do I do that?</p>
  
  <pre><code>(function(currentScriptPath){
      angular.module('app', [])
          .directive('test', function () {
              return {
                  restrict: 'E',
                  scope: {},
                  templateUrl: currentScriptPath.replace('.js', '.html'),
                  replace: true,
                  controller: TestController,
                  controllerAs: 'vm',
                  bindToController: true
          };
      });
  })(
      (function () {
          var scripts = document.getElementsByTagName("script");
          var currentScriptPath = scripts[scripts.length - 1].src;
          return currentScriptPath;
      })()
  );
  
  TestController.$inject = ['$scope'];
  
  function TestController($scope) {
      // try to access $scope.currentScriptPath here
  }
  </code></pre>