如何使用 *NgIf 或任何 Ng 函数删除 Dom 元素和组件?
我有一个下拉列表;根据下拉菜单,它将显示不同的形式。当人员更改下拉类型然后稍后返回相同的下拉类型时 - 以前的表单数据仍然存在,何时应该清除。
当下拉列表更改时删除所有表单、变量和组件本身的最佳方法是什么?
见下面的声明,
<div class = "addressformtotal">
<div class = "addressblock">
<app-address-formatheader-form></app-address-formatheader-form>
<div *ngIf="formatMessage?.addressFormatDescription.includes('Standard')"><app-address-mailing-standard-form></app-address-mailing-standard-form></div>
<div *ngIf="formatMessage?.addressFormatDescription.includes('Military')"><app-address-mailing-military-form></app-address-mailing-military-form></div>
<div *ngIf="formatMessage?.addressFormatDescription.includes('Post')"><app-address-mailing-pobox-form></app-address-mailing-pobox-form></div>
<div *ngIf="formatMessage?.addressFormatDescription.includes('Free')"><app-address-free-form></app-address-free-form></div>
<div *ngIf="formatMessage?.addressFormatDescription.includes('Rural')"><app-address-mailing-rural-form></app-address-mailing-rural-form></div>
<div *ngIf="formatMessage?.addressFormatDescription.includes('International')"><app-address-mailing-international-form></app-address-mailing-international-form></div>
</div>
米琪卡哇伊
PIPIONE
相关分类