I'm trying to perform a search with ionic 3 + AngularFire2. I have a list with all the data of the firebase, however I can not make a filter of this data, it does not return anything to me.
file.ts
import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database';
dashboardData: FirebaseListObservable<any>;
constructor(private afDatabase: AngularFireDatabase) {
this.dashboardData = this.afDatabase.list('/motoristas');
}
getRota(rota: string){
this.dashboardData = this.afDatabase.list('motoristas', {
query: {
orderByChild: 'rota',
equalTo: rota
}
});
}
.html file
<ion-list>
<ion-item>
<ion-label>Rota</ion-label>
<ion-select [(ngModel)]="rota" (ionChange)="getRota(rota)">
<ion-option value="Caruaru">Caruaru</ion-option>
<ion-option value="Belo Jardim">Belo Jardim</ion-option>
</ion-select>
</ion-item>
</ion-list>
<ion-list>
<ion-item *ngFor="let motorista of dashboardData | async" (click)="showOptions(country.$key, country.nomeMotorista)">
<ion-thumbnail item-start>
<img src="./assets/img/icon.svg">
</ion-thumbnail>
<h2>{{ motorista.nomeMotorista }}</h2>
<p> {{ motorista.rota }} </p>
<button ion-button clear item-end color="outro"> <ion-icon ios="ios-people" md="md-people"> {{ motorista.numPassageiros }} </ion-icon></button>
</ion-item>
</ion-list>
I have no return.