I've added an Ion-select in my project, and I'm trying to filter for when I click, just show the information for that click. But for some reason it is giving me error and how I am new in all this, I do not know what it can be. If anyone can help me, I will be very happy. And I'm sorry for the translated English.
HTML
<ion-select (ionChange)="selecionaregiao()" [(ngModel)]="regiao">
<ion-option value="opt1"></ion-option>
<ion-option value="opt2">Zona Oeste</ion-option>
<ion-option value="opt3">Zona Norte</ion-option>
<ion-option value="opt4">Zona Sul</ion-option>
</ion-select>
DATABASE.TS
getRegiao(pregiao: string){
return new Promise<Regiao[]>((resolve, reject) => {
let sql = "SELECT * FROM TB_REGIAO" + pregiao;
console.log(sql);
this.executeQuery(sql).then(data => {
let regioes = [];
data.forEach(function (row) {
let regiao: Regiao = { nom_regiao: row[0]}
regioes.push(regiao);
});
resolve();
}).catch(error => {
console.log(error);
});
});
}
and Function .ts
selecionaregiao(pregiao: string) {
this.db.getRegiao(pregiao)
.then(data => this.regioes = data)
.catch(error => console.log('Something want wrong!'));
}