I can create a component like this pretty easily.
@Component({
selector: 'ui-foo',
template: `
<ng-content select=".a"></ng-content>
<ui-bar></ui-bar>
<ng-content select=".b"></ng-content>
`
})
export class UiFoo {};
Which when used like:
<ui-foo>
<div class="a">A</div>
<div class="b">B</div>
</ui-foo>
Results in:
<ui-foo>
<div class="a">A</div>
<ui-bar></ui-bar>
<div class="b">B</div>
</ui-foo>
This is pretty cool, but what I'd really like to do is have a user provide
content like:
<ui-foo>
<div class="a">A</div> <!-- maybe with *ngFor -->
<div class="a">A</div>
<div class="a">A</div>
<div class="a">A</div>
<!-- any amount -->
</ui-foo>
I'd like that to result in the following:
<ui-foo>
<div class="a">A</div>
<ui-bar></ui-bar>
<div class="a">A</div>
<ui-bar></ui-bar>
<div class="a">A</div>
<ui-bar></ui-bar>
<div class="a">A</div>
</ui-foo>
Is this or something similar possible in Angular 2? I used intersperse as
an example, but generally how can I create content between user provided
elements through a single ng-content?
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.