Search code examples
angularjsangularjs-directiveangular-ng-if

why "<ng-container> not working in "<tr>" tag


Code:

<table>
    <tr>
        <ng-container ng-if="false"> // here ng-container not working
            <td>
            <ng-container ng-if="false">abc</ng-container>// here ng-container working fine
            </td>
            <td><ng-container ng-if="true">xyz</ng-container></td>
        </ng-container>
    </tr>
</table>

OutPut:

xyz

here expected output is no one cell was display but in between <tr> and <td> tags <ng-container ng-if="false"> are not working.

If anyone idea about this problem please get solution.


Solution

  • I analysis this issue in deep and i faced some situation like <ng-container ng-if=""> or <ng-container ng-show=""> or <ng-container ng-hide=""> conditions not working between <table> and <td> tag but working inside <td> tag also <ng-container ng-repeat=""> is working fine in above all criteria.