title: Angularjs directive - exportTable not defined
body: <p>I've got small  problem about attaching directive to my module. Let's see:</p>
  
  <p>I've got controller.js:</p>
  
  <pre><code>var app = angular.module("app", []);
  
  app.controller('someCtrl', function($scope) {
  
   $scope.exportAction = function(){
         switch($scope.export_action){
             case 'pdf': $scope.$broadcast('export-pdf', {});
                         break;
             case 'excel': $scope.$broadcast('export-excel', {});
                         break;
             case 'doc': $scope.$broadcast('export-doc', {});
                         break;
             default: console.log('no event caught');
          }
       }
  
   });
  </code></pre>
  
  <p>and when i want to attach below this directive:</p>
  
  <pre><code> app.directive('exportTable', function() {
   var exportTable = function(){
  
   var link = function($scope, elm, attr){
  
   $scope.$on("export-pdf", function(e, d){
         elm.tableExport({type:'pdf', escape:'false'});
    });
  
   $scope.$on("export-excel", function(e, d){
          elm.tableExport({type:'excel', escape:false});
    });
  
   $scope.$on("export-doc", function(e, d){
        elm.tableExport({type: 'doc', escape:false});
    });
  
   }
  
   return {
     restrict: 'C',
     link: link
      }
    }
  });
  </code></pre>
  
  <p>I've got "error: directive is undefined". How I have to attach this? </p>