I have two segments. When 'Manual' segment is selected, "is not auto" is not showing but instead showing as "is auto" although the value of is false
<ion-segment mode="md" [(ngModel)]="is_auto"> <ion-segment-button mode="md" [value]="true"> <ion-label>Auto</ion-label> </ion-segment-button> <ion-segment-button mode="md" [value]="false"> <ion-label>Manual</ion-label> </ion-segment-button> </ion-segment> <div *ngIf="is_auto === false"> is not auto </div> <div *ngIf="is_auto"> is auto </div>
When 'Auto' segment is selected, output is
true
is auto
When 'Manual' segment is selected, output is
false
is auto
I have imported Browser Module and Common Module.
UPDATE
The variable is cast as a boolean, but ion-segment keeps getting away with converting it to a string. ionic 3 works fine but not with ionic 4
SOLVED
cast the variable as string as ionic 4 ion-segment seems to handle all value as string
https://stackoverflow.com/questions/65841948/div-ngif-is-auto-false-is-not-showing January 22, 2021 at 04:50PM
没有评论:
发表评论