-
Notifications
You must be signed in to change notification settings - Fork 27.5k
feat($compile): support directive virtual groups #2783
Conversation
@@ -573,6 +587,47 @@ function $CompileProvider($provide) { | |||
return directives; | |||
} | |||
|
|||
/** | |||
* Given a node witch a X-start it collects all of the siblings until it find X-end. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: "witch a" -> "with an" or "which has an"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Cool! Just one comment: It may be necessary to state that this introduces a breaking change as any previous directive that ended with |
By appending directive-start and directive-end to a directive it is now possible to have the directive act on a group of elements. It is now possible to iterate over multiple elements like so: <table> <tr ng-repeat-start="item in list">I get repeated</tr> <tr ng-repeat-end>I also get repeated</tr> </table>
I have tried to run this example but got the error: See details here: http://stackoverflow.com/questions/10457833/how-would-i-render-a-dynamic-definition-list-using-angular/16808545#16808545 |
I've made a fix for this inn pull request #2859 . |
Wouldn't it make more sense to have a
When ng-group renders, it always removes itself and adds it's children to its parent element. |
I've built on the work of angular#2783 to make multi-elements possible in all directive decralation styles. Basically angular#2783 was limited to directives declared via attributes. With this commit, appending X-start and X-end would work in Comments, Attributes, ClassNames and ElementNames ```html <table> <!-- directive: ng-repeat-start item in list --> <tr>If ngRepeat's 'restrict' get changed to include 'M'</tr> <tr>I get repeated</tr> <!-- ng-repeat-end --> </table> ```
I've built on the work of angular#2783 to make multi-elements possible in all directive decralation styles. Basically angular#2783 was limited to directives declared via attributes. With this commit, appending X-start and X-end would work in Comments, Attributes, ClassNames and ElementNames ```html <table> <!-- directive: ng-repeat-start item in list --> <tr>If ngRepeat's 'restrict' get changed to include 'M'</tr> <tr>I get repeated</tr> <!-- ng-repeat-end --> </table> ```
By appending X-start and X-end to a directive it is now possible
to have the directive act on a group of elements.
It is now possible to iterate over multiple elements like so: