-
Notifications
You must be signed in to change notification settings - Fork 48
Returning List only once using .take(1) results in error #47
Comments
Hi @JaneDawson, thanks for spotting this issue! It looks like the types aren't matching up correctly. WorkaroundAs a quick workaround just change your list's type to use Beforegroceries: AfoListObservable<any[]>; Aftergroceries: any; Help wantedObviously this is not an ideal solution so anyone interested in helping is welcome to make a PR! |
Hi @adriancarriger, thanks for the workaround. However, I'm not sure how to implement it, properly. Currently I have:
This results in the error as posted above.
|
Hi @JaneDawson, I made a quick demo (with code) to better explain the workaround. Basically you can just use this for your getAllOffersOnce() {
return (<any>this.afoDatabase.list('groceries')).take(1);
} The Again, I'm hopeful that this workaround won't be required in the future. |
Hi @adriancarriger: Thank you for your patience and the further explanation. It's working like this. |
Awesome, glad to hear! 👍 |
I tried this exact code and my observable is still firing twice. has there been some changes? |
When I return a Firebase List Object only once like this:
return this.db.list('/items').take(1);
I receive the following error in VS Studio Code:However, everything seems to compile fine.
Returning an object only once (
return this.db.object('/items').take(1);
) works fine.When I use AngularFire2 instead, returning a list only once like this works fine.
The text was updated successfully, but these errors were encountered: