samedi 21 février 2015

Angularjs - grouping ng show


How can I group ng-shows without ruining the dom tree order?


For example I have these ng-shows:



<ul>
<li>A</li>
<li>B</li>
<li ng-show="canEdit">C</li>
<li ng-show="canEdit">D</li>
<li ng-show="canEdit">E</li>
</ul>


Can I somehow do something like this:



<ul>
<li>A</li>
<li>B</li>
{{ng-show-start(canEdit)}}
<li>C</li>
<li>D</li>
<li>E</li>
{{ng-show-end(canEdit)}}
</ul>


Using an DOM element instead of ng-show-start&end can also be an solution, but it must be able to remove its element and show the contents on true.





Aucun commentaire:

Enregistrer un commentaire