This is my .ts file
import { Component, OnInit } from '@angular/core';
import { AngularFireDatabase, FirebaseListObservable, FirebaseObjectObservable } from 'angularfire2/database';
@Component({
selector: 'app-candidate-reg-success',
templateUrl: './candidate-reg-success.component.html',
styleUrls: ['./candidate-reg-success.component.css']
})
export class CandidateRegSuccessComponent implements OnInit {
constructor() {
debugger;
const rootRef=firebase.database.ref();
const mail=rootRef.child('candidates_list').orderByChild('email').equalTo('[email protected]');
console.log(mail);
}
ngOnInit() {
}
}
I am trying to query the user from candidates_list table which has the email address [email protected].
But I am unable to console it. It shows a error like
Property 'ref' does not exist on type 'typeof database'.
Any solution to query angular firebase database?
you need to inject the AngularFirebaseData in constructor and change the code and try again
import { Component, OnInit } from '@angular/core';
import { AngularFireDatabase, FirebaseListObservable,
FirebaseObjectObservable } from 'angularfire2/database';
@Component({
selector: 'app-candidate-reg-success',
templateUrl: './candidate-reg-success.component.html',
styleUrls: ['./candidate-reg-success.component.css']
})
export class CandidateRegSuccessComponent implements OnInit {
constructor(public db: AngularFireDatabase) {
debugger;
db.list('/candidates_list', ref => ref.orderByChild('email').equalTo('[email protected]'));
}
ngOnInit() {
}}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With