Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body ng-app="myApp">
  <div my-directive></div>
</body>
</html>
 
  var app = angular.module('myApp', []);
  app.config(['$compileProvider', function ($compileProvider) {
    $compileProvider.directive('myDirective', function() {
      return {
        restrict: 'A',
        replace: true,
        scope: true,
        template: '<span>hello world</span>',
        compile: function () {
          console.log('complile');
          return function () {
            console.log('link');
          };
        }
      };
    });
  }]);
  angular.module('myApp').directive('myDirective', function() {
    return {
      restrict: 'A',
      scope: true,
      compile: function () {
        console.log('complile');
        return function () {
          console.log('link');
        };
      }
    };
  });
app.run(['$injector', function($injector) {
  console.log($injector.get('myDirective' + 'Directive'));
}]);
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
Lovesueeepro
0viewers