Chapter 1: Working through the directive spectrum - The Comment Directive
HTML
<script src="https://code.angularjs.org/1.3.2/angular.min.js"></script>
<div ng-app="myApp">
<!-- directive: comment-directive val1 val2 val3 -->
</div>
JavaScript
angular.module('myApp', [])
.directive('commentDirective', function ($log) {
return {
restrict: 'M',
// without replace: true, the template cannot
// be inserted into the DOM
replace: true,
template: '<p>A comment directive</p>',
link: function(scope, el, attrs) {
$log.log(el.html())
// <p>A comment directive</p>
$log.log(attrs)
// 'val1 val2 val3'
}
};
});