【问题标题】:Not able to query through the list in firebase using angularfire2无法使用 angularfire2 查询 firebase 中的列表
【发布时间】:2018-01-09 15:23:28
【问题描述】:

我想从 firebase 数据库中获取 text=Groomers 的用户列表 我收到有关 .indexOn 的 firebase 警告,但没有获得用户列表。 以下是我的代码:

import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { AuthService } from '../../services/auth.service';
import { AngularFireDatabase } from 'angularfire2/database';
import { AngularFireAuth } from 'angularfire2/auth';
import { Observable } from 'rxjs/Observable';

@Component({
selector: 'app-animal-services',
templateUrl: './animal-services.component.html',
styleUrls: ['./animal-services.component.css']
})
export class AnimalServicesComponent implements OnInit {

users: Observable<any[]>;

constructor(public _firebaseAuth: AngularFireAuth, private db:  AngularFireDatabase, private router: Router) {

 this.users = db.list('/professionals', ref => ref.orderByChild('text').equalTo("Groomers")).valueChanges();


}

ngOnInit() {
}

}

下面是我的数据库图片:

【问题讨论】:

    标签: firebase firebase-realtime-database angularfire2


    【解决方案1】:

    orderByChild("text") 应该是orderByChild("qualification")

    【讨论】:

    • 使用 orderByChild("qualification") 后仍然没有得到列表。
    【解决方案2】:

    呸!我通过以下方式更改数据库找到了自己的方法:

    下面是我database的图片:

    【讨论】:

      猜你喜欢
      • 2017-06-28
      • 2017-07-21
      • 1970-01-01
      • 1970-01-01
      • 2018-07-21
      • 2017-06-05
      • 2018-02-19
      • 2023-03-17
      • 1970-01-01
      相关资源
      最近更新 更多