var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope, fooDirective) {
$scope.name = 'World';
$scope.code = fooDirective;
});
app.directive('foo', function() {
return function(scope, el, attr) {
el.append('foo');
};
});
//app.factory('fooDirective', () => angular.noop);
app.directive('foo', function() {
return function(scope, el, attr) {
el.append('foo2');
};
});
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script>document.write('<base href="' + document.location + '" />');</script>
<link rel="stylesheet" href="style.css" />
<script data-require="angular.js@1.4.x" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js" data-semver="1.4.7"></script>
<script src="app.js"></script>
</head>
<body ng-controller="MainCtrl">
<p>Hello {{name}}!</p>
<foo></foo>
<pre>{{code|json}}</pre>
</body>
</html>
/* Put your css in here */