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

自闭症网瘾萝莉.ら 提交于 2019-12-08 00:15:05

问题


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.


回答1:


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.




回答2:


Try to put ng-container before table row

<table>
    <ng-container ng-if="false">
        <tr>
            <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>
        </tr>
    </ng-container>
</table>


来源:https://stackoverflow.com/questions/43774482/why-ng-container-not-working-in-tr-tag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!