My problem is (apparently) simple. This is the result I would like to achieve :
I manage to get this result with the following code (home.page.html
) :
<ion-item>
<ion-label position="floating" color="primary">Type</ion-label>
<ion-select formControlName="type" placeholder="Insert your type here...">
</ion-select>
</ion-item>
Now, when I add some ion-selected-option for this ion-select, like this :
<ion-item>
<ion-label position="floating" color="primary">Type</ion-label>
<ion-select formControlName="type" placeholder="Insert your type here...">
<ion-select-option *ngFor="let type of types" [value]="type">{{type}}</ion-select-option>
</ion-select>
</ion-item>
the placeholder is replaced by the value of the first ion-selected-option when the page loads.
The values of these ion-selected-option
are declared in the constructor of my home.page.ts like such :
constructor(public formBuilder: FormBuilder){
this.types = [
"Advert",
"OOH/POS simple",
"OOH/POS complex",
"Other"
];
}