0
I have this method, when choosing a country, search the states.
filtrarEstado(pais : Pais) : void{
this.loading = true;
this.estadoService.getEstadosPorPais(pais).subscribe(
(data :any) => {
this.estados = data.lista;
this.loading = false;
}
);
}
Component in the HTML
<mat-form-field class="formulario-full-width">
<mat-select placeholder="País" name="pais"
[(ngModel)]="municipioBuscar.paisId"
matTooltip="Deve selecionar um país">
<mat-option (blur)="filtrarEstado(0)">Nenhum</mat-option>
<mat-option *ngFor="let pais of paises" [value]="pais"
(blur)="filtrarEstado(pais)">{{pais.descricao}}
</mat-option>
</mat-select>
</mat-form-field>
But when I choose none, does not execute the method state, thus the state component is completed with the states of the last chosen country.
What’s wrong with it?