I have 3 different directives, <one> , <two> , <three> .
I want to scroll their ids and paste them into ng-repeat
<ul> <li ng-repeat="panel in panels"> <panel> </panel> </li> </ul>
The resulting html that I would like to achieve will be as follows:
<ul> <li> <panel> <one></one> </panel> </li> <li> <panel> <two></two> </panel> </li> <li> <panel> <three></three> </panel> </li> </ul>
And since each has its own template:
<ul> <li> <div class="panel"> <div id="one"> </div> </div> </li> <li> <div class="panel"> <div id="two"> </div> </div> </li> <li> <div class="panel"> <div id="three"> </div> </div> </li> </ul>
I'm not sure how to do this? Is it possible? do i need ng-compile have a directive inside a directive?
Should I use only one directive and use ng-switch ?
Am I missing a simpler approach?
I know this works:
create the <panel-content> directive.
I include this in the <panel> directive:
to do
<ng-switch="panel.id"> <ng-switch-when="one"> <ng-switch-when="twp"> <ng-switch-when="three"> </ng-switch>`
But that seems cumbersome.
Trufa source share