Is there a way to tell AngularJS not to display the top HTML element which has ng-if directive. I want angular to display child content only.
Angular Code:
<div ng-if="checked" id="div1">
<div id="div2">ABC</div>
<div id="div3">KLM</div>
<div id="div4">PQR</div>
</div>
Rendered HTML:
<div id="div1">
<div id="div2">ABC</div>
<div id="div3">KLM</div>
<div id="div4">PQR</div>
</div>
What I want:
<div id="div2">ABC</div>
<div id="div3">KLM</div>
<div id="div4">PQR</div>
Here is a fiddle. http://jsfiddle.net/9mgTS/. I do not want #div1
in HTML. I just want #div2,3,4
if checked
is true
.
A possible solution can be adding ng-if to all child elements but I do not want to do this.
template:function(el,attrs)
to run some logic based on attributes and return the appropriate html – Milliner<ng-container *ngIf="true">
– Poundage