Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49240

Ionic 4 ion-select-option [selected] field is not working

$
0
0

@king-ds wrote:

Hi Ionites, would like to know the reason why selected parameter in ion-select-option is not working.

Here is the code snippet in html:

      <ion-select multiple="true" [(ngModel)]="selectedData" (ionChange)="OnChange($event)" cancelText="Cancel" okText="Submit">
        <ion-select-option *ngFor="let item of CDRS" [value]="item.id" [selected]="item.value" >
          {{ item.name }}
        </ion-select-option>
      </ion-select>

Please note that the item.value is boolean field.

From .ts file, this is the variable (CDRS) that I’m looping with.

this.CDRS = [
      {
        id : 1,
        name : "value 1",
        value : true,
      },
      ...

Anyone know how to check or select a certain ion-select-option using the selected field specially when its CDRS.value is set to true? Thanks.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49240

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>