As you know (probably), AngularJS provides ability to create directives based on comments (M).
But why ?
What is the use case ? Any idea ?
One of my students asked me and I was not able to provide any examples... Thanks in advance !
As you know (probably), AngularJS provides ability to create directives based on comments (M).
But why ?
What is the use case ? Any idea ?
One of my students asked me and I was not able to provide any examples... Thanks in advance !
One Use-Case, from the Docs:
Best practice: Comment directives were commonly used in places where the DOM API limits the ability to create directives that spanned multiple elements (e.g. inside
<table>
elements). AngularJS 1.2 introducesng-repeat-start
andng-repeat-end
as a better solution to this problem. Developers are encouraged to use this over custom comment directives when possible.
The "M" restriction is used the least often, usually only for backwards compatibility and for passing markup validations.
i am thinking of something like ng-if
it put a commented html that indicate the place that an element can be inserted if matching criteria, may be it has it's own cases people will use it.