Ion select


#1

WHY IS NOT CHECKED IF this.descricao = true ?

<ion-item>
      <ion-label>Buscar por:</ion-label>
      <ion-select cancelText="Cancelar" #tipo>
        <ion-option *ngFor="let opcao of this.options" [value]="opcao.value" [selected]="opcao.selected">{{opcao.nome}}</ion-option>
      </ion-select>
    </ion-item>
 public options = [
      { nome: "Descrição", value: "descricao", selected: this.descricao },
      { nome: "Código", value: "codigo", selected: this.codigo },
      { nome: "Referência", value: "referencia", selected: this.referencia }
    ]
ionViewWillEnter(){
      this.menu.enable(true);
      this.buscapadrao = "descricao";
          if(this.buscapadrao == "descricao"){
            this.descricao = true;
            this.codigo = false;
            this.referencia = false;
          }else if(this.buscapadrao == "codigo"){
            this.descricao = false;
            this.codigo = true;
            this.referencia = false;
          }else{
            this.descricao = true;
            this.codigo = false;
            this.referencia = true;
          }
    }

#2

Because options[0].selected is permanently whatever descricao was initially. Further changes to descricao later won’t magically propagate. There are a number of ways to make it do so, but I would instead recommend storing this value in only one place, wherever you decide is easiest to work with.