Property 'take' does not exist on type 'AngularFireObject<Profile>'
Hey Guys, I got this error, " Property 'take' does not exist on type 'AngularFireObject
import { Injectable } from '@angular/core'; import { AngularFireDatabase, AngularFireObject } from 'angularfire2/database'; import { User } from 'firebase/app'; import { Profile } from '../models/profile/profile.interface'; import 'rxjs/add/operator/take'; @Injectable()
export class DataService {
profileObject: AngularFireObject<Profile>
constructor(private database: AngularFireDatabase){
console.log('Hello Data Provider');
}
getProfile(user: User){
this.profileObject = this.database.object(`/profiles/${user.uid}`);
return this.profileObject.take(1);
}
async saveProfile(user: User, profile : Profile){
this.profileObject = this.database.object(/profiles/${user.uid});
try{
await this.profileObject.set(profile);
return true;
}
catch(e){
console.error(e); return false;
}
}
}
I also imported the rxjs, but still didn't work, please help
Thanks
This maybe solve your problem:
Replace this
return this.profileObject.take(1);
by this:
return this.profileObject.valueChanges();