Using this code:
<ion-item>
<ion-label floating>Payment Frequency</ion-label>
<ion-select #planPayFreq (change)="elementChanged(planPayFreq)"
formControlName="planPayFreq" [(ngModel)]="ongoingPlansForm.planPayFreq" multiple="false">
<ion-option value="1" selected="true">Annual</ion-option>
<ion-option value=".08333333">Monthly</ion-option>
</ion-select>
</ion-item>
I would expect that Annual, or the first option, would be selected upon load. This does happen, but when you try to do an *ngIf=“ongoingPlansForm.planPayFreq == 1”, it fails because the value is not set as 1 for this select. When inspecting the element on load (before I select anything it looks like:
<ion-select formcontrolname="planPayFreq" multiple="false" ng-reflect-multiple="false" ng-reflect-name="planPayFreq" class="ng-untouched ng-pristine ng-invalid">
And after selecting Annual as an option, it changes to:
<ion-select formcontrolname="planPayFreq" multiple="false" ng-reflect-multiple="false" ng-reflect-name="planPayFreq" class="ng-touched ng-dirty ng-valid" ng-reflect-model="1">
And now the *ngif works fine.
Is this a bug with the selected=“true” property?