angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

Property 'take' does not exist on type 'AngularFireObject<Profile>'

Open noor07 opened this issue 8 years ago • 1 comments

Hey Guys, I got this error, " Property 'take' does not exist on type 'AngularFireObject' " This is my code===

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

noor07 avatar Mar 23 '18 13:03 noor07

This maybe solve your problem:

Replace this return this.profileObject.take(1);

by this: return this.profileObject.valueChanges();

joel-daros avatar Apr 07 '18 01:04 joel-daros