What does restrict E, A, M, C, or even EA, EAM, EAC, or EAMC mean?
HTML
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
<div ng-app="app">
<hello-mike loc="'element'"></hello-mike>
<div hello-mike="" loc="'attribute'"></div>
<div>
<!-- directive: hello-mike comment -->
</div>
<div class="hello-mike: class;"></div>
</div>
JavaScript
var app = angular.module('app', []);
app.directive('helloMike', function() {
return {
restrict: 'EAMC',
template: '<div>Hello, Mike from {{loc}}!</div>',
scope: {
loc: '='
},
replace: true,
link: function(scope, elem, attrs) {
if (attrs.helloMike) {
scope.loc = attrs.helloMike;
}
}
};
});