I have the select below and when I change the value my ngModel value comes back with a string, not a boolean
<select class="form-control" [(ngModel)]="ceModal.isApproved" (ngModelChange)="markDirty()" name="ceIsApproved"> <option [ngValue]=null>None selected</option> <option value=true>Yes</option> <option value=false>No</option> </select>
in ngModelChange I do a simple check to see what 'ceModal.isApprvoed' is and it's "true" and "false" not true and false. How can I keep them as bools?
Using
[ngValue]=true
fixes my issue
Bind to value with square brackets: [value]="false"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.