按城市筛选报价列表,该列表等于我将在HTML中输入的值

时间:2018-11-23 12:39:37

标签: typescript firebase firebase-realtime-database ionic3

我正在练习一些Angular / Ionic,并且在弄清楚如何获得按城市分类的offerLists过滤器上有些困难,

这就是我如何获得所有OffAll.ts的方式, 我得到所有用户的报价,我必须加载所有用户数据。像这样:

export class AllOffresPage {

public offreList: Array<any>;

constructor(public navCtrl: NavController, public navParams: NavParams, 
private db : AngularFireDatabase) {
}

ionViewDidLoad() {
let ref = firebase.database().ref("userProfile");
ref.on("value", userListSnapshot => {
  this.offreList = [];
  userListSnapshot.forEach(userSnapshot => {
    let offerListSnapshot = userSnapshot.child("offreList");

    offerListSnapshot.forEach(offerSnapshot => {
      this.offreList.push({
        id: offerSnapshot.key,
        titre: offerSnapshot.val().titre,
        sector: offerSnapshot.val().sector,
        city: offerSnapshot.val().city,
        descrip: offerSnapshot.val().descrip,
      });
      console.log(offerListSnapshot.key)
      return false;
    });
    })
   });
   }

现在的问题是我如何获得按城市分类的offerLists过滤器,

 export class OffreByVillePage {

 constructor(public navCtrl: NavController, public navParams: NavParams) {
 }

 ionViewDidLoad() {

   // I don't know the code to show data filtered by city, I m stacking for 
    2 days
 }

0 个答案:

没有答案