Ion select


WHY IS NOT CHECKED IF this.descricao = true ?

      <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>
 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 }
      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;
            this.descricao = true;
            this.codigo = false;
            this.referencia = true;


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.