Multiple Directives -Method 2
by gogirl
HTML
<div ng-app='myApp'>
<XMP>
<div my-d></div>
<div my-d1></div>
<my-d1></my-d1>
<p my-d1></p>
</XMP>
<p>As default, the directives can now be applied as attributes to html tags
</p>
<p>To define as an element and use as a tag another method is used
</p>
<p>
Output:
<div my-d></div>
<div my-d1></div>
<my-d1></my-d1>
<p my-d1></p>
</p>
</div>
JavaScript
angular.module("myApp", []);
angular.module('myApp', ['myApp.myD', 'myApp.myD1']);
angular.module('myApp.myD', []).directive('myD', function () {
return {
template: 'Similar to ng-include: tag will not work as element'
};
});
angular.module('myApp.myD1', []).directive('myD1', function () {
return {
template: 'Similar to ng-include: tag will not work as element'
};
});