Issue
What does M
stand for in the restrict AngularJS option?
From AngularJS Developer Guide - Directives documentation I see that the:
The restrict option is typically set to:
...
'C' - only matches class name
'M' - only matches comment
But in order to avoid memorizing that C
is for class and M
is for comment, I would like to understand why the M
is used.
I did not find anything about it on the internet. My guess is that the m
is the next consonant letter in the word comment
after the c
and since the c
is already taken by comment the m
is used.
Solution
This does exactly what it says it does - allows a directive to be matched to a comment.
Thus:
directive('yourDirective', function() {
return {
restrict: 'M',
template: '<span>Something in here</span>'
};
});
Can be used like this:
<!-- directive: your-directive -->
Answered By - Brendan Green
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.