Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 230108

Ionic 4 ion-select pre select value

$
0
0

1 more thing that I noticed, putting it here if anyone runs into this issue.

When it’s a multiselect (multiple=true) and you set [selectedText]=“selectedCodeValue” it will display 1 long string instead of comma separated string. The way I avoid it is as follows

<ion-select [(ngModel)]="selectedCodeValue" name="selectCode" 
  multiple="true" placeholder="Tap to select.."
  [selectedText]="selectedCodeValue ? selectedCodeValue.toString() : selectedCodeValue"
  (ionChange)="codeSelected()" required >
        <ion-select-option *ngFor="let code of availableCodes" value="{{code.id}}">
          {{code.id}} -  {{code.description}}
        </ion-select-option>
  </ion-select>

Viewing all articles
Browse latest Browse all 230108

Trending Articles