Ion-select no refresh

Im using Ionic 4

have this code:

        <ion-select [(ngModel)]="IDEscuel" (ionChange)='Cambio_Escuela()' placeholder="Seleccione una Escuela">
            <ion-select-option value="SE" selected> Seleccione Escuela</ion-select-option>
            <ion-select-option *ngFor="let escuela of Escuelas" [value]='escuela.id'> {{ escuela.nombre }} </ion-select-option>
        </ion-select>

I fill Escueles from database

 this._profileServ.getEscuelasPaisEstado(this.Pais,this.Estado).then((EscuelasL:any) => {
                    this.Escuelas = EscuelasL;    
 });  

then when the this.Pais change I refill the this.Escuelas, but if the data from database is empty instead of clean or list of Escuelas the control how the same list that was before, if I console.log the value of this.Escuelas it show empty. but in the app show the list before.

Any help

Hi! Did you find any solution? It stills in Ionic 4.1.0 :c

Hi, @Motero69 @ieulerchavez

I think this will work:

this._profileServ.getEscuelasPaisEstado(this.Pais,this.Estado).then((EscuelasL:any) => {
                   this.Escuelas=[];
                    this.Escuelas = EscuelasL;    
 });  

Here I have cleared this.Escuelas so, that every time it’ll be filled old values are replaced, hence it can solve your problem.
Hope it’ll help you.

1 Like