[英]How to replace the text in ion-item based on if condition
I have a button on click of which a pop up with some values appear and after selecting a value that selected value based on conditions gets populated in ion-item, the issue is the ion-item value based on conditions instead of getting replaced a new ion-item cell is added. 我有一个按钮,单击后会出现一个弹出窗口,其中显示一些值,并且选择了一个值后,将根据条件选择的值填充到ion-item中,问题是基于条件的ion-item值而不是替换为新的添加离子项目单元。
I'm new to ionic so couldn't identify what mistake im doing. 我是离子技术的新手,所以无法确定自己在做什么错误。
<ion-label style="margin-bottom:10px; font-size:15px;" color="basic" stacked>{{field.label}}</ion-label>
<button ion-item block color="basic" (click)="getOulistData(field.name,field.value)">Tap to choose</button>
<div *ngFor ="let x of ouHierarchy">
<div *ngIf = "field.name ===x.level">
<ion-item>{{x.value}}</ion-item>
</div>
</div>
<div>
<ion-item *ngIf="field.value">
{{field.value}}
</ion-item>
</div>```
Change this: 更改此:
<ion-item *ngIf="field.value">
{{field.value}}
</ion-item>
Into this: 变成这个:
<ion-item *ngIf="field.name != x.level">
{{field.value}}
</ion-item>
By doing the above, you will have one ion item, if the first ion item condition is not satisfied then this ion item will appear. 通过执行上述操作,您将拥有一个离子项目,如果不满足第一个离子项目的条件,则该离子项目将出现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.