Ion select subtitle

Hi,

I have an ion select, I want to show a subtitle that can be changed when there is no option to be selected.

This is my html code:

<ion-item>
    <ion-label>Equipo</ion-label>
    <ion-select [(ngModel)]="selEquipoHis" (ionChange)="doSelect()">
      <ion-option *ngFor="let i of equipos" value="{{ i.Address }}">{{ i.Alias }}</ion-option>
    </ion-select>
</ion-item>

If array equipos has elements I want to show a subtitle for example: “Choose a device”, but if equipos has no elements change the subtitle to “No devices ready”. My actual code shows an empty list of options with a title Equipo and OK and Cancel buttons.

Any guidance?

Thank you.

I want to know how to add the subtitle just like the following example from Ionic API:

Anyone??

Thanks

1 Like

Ok done, using selectOptions

html:

<ion-select [selectOptions]="selectOptions" [(ngModel)]="selEquipoHis" (ionChange)="doSelect()">

ts:

   this.selectOptions = {
    title: 'Aviso',
    subTitle: 'Equipos no disponibles'        
  };
1 Like