Reputation: 165
This is my Page where I am calling two components Panel and jointbutton:
<panel src="a"
data1="b"
data2="Student Id:"
data3="Class:"
data4="Roll No : " data5="Batch : ">
<joint-button btnname="Edit" icon="glyphicon glyphicon-pencil" color="btn btn-primary"></joint-button>
<joint-button btnname="Delete" icon="glyphicon glyphicon-trash" color="btn btn-danger"></joint-button>
</panel>
This is my panel.html where i have used
<div class="col-md-3">
<div class="custom5">
<ng-content></ng-content>
</div>
<div class="custom6">
<ng-content></ng-content>
</div>
</div>
problem here is both jointbuttons are showing in first <ng-content></ng-content>
So my Question is::
first of all Can we use <ng-content></ng-content>
more than once. If yes then why doesn't it work.
If we can't use <ng-content></ng-content>
more than once then what is the solution for locating two components in two different places.
Upvotes: 2
Views: 944
Reputation: 42669
ng-content
can take an attribute select
which is a css selector of the element to include\select.
So this should work (i have not tried)
<div class="custom5">
<ng-content select="joint-button'[btnname=Edit]'"></ng-content>
</div>
<div class="custom6">
<ng-content select="joint-button'[btnname=Delete]'"></ng-content>
</div>
Recently this was demo'ed in AngularConnect, see this video https://www.youtube.com/watch?v=4YmnbGoh49U
Upvotes: 2