-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FirebaseObjectObservable after using a switchMap #1008
Comments
That isn't how The AngularFire2 observables implement |
I'm trying to wrap my head around it. Does this mean that what I'm trying to do is impossible, or that the source observable should be the Firebase observable? |
In a broad sense, there will be some way of doing what it is that you are trying to do, but it is impossible for the observable returned by the Think about it this way. When the snippet of code in your issue runs, you will have two observable instances: You could arrange things differently by separating
If you have an observable for a button click you could access the AngularFire2 observable using
You'd need to manage the Also, if your component is created and torn down with each route change, you could always use the route's snapshot:
|
So I've been working a lot with Observables, and I'd advice towards caution against something like this. RxJS is a great technology, but it creates a lot of mental overhead, meaning one has to sometimes spend quite a long time deciphering how certain observable chains work. The KISS principle still applies. |
Going to close as not an af2 issue, but feel free to continue to discuss. Convos like this might be better suited for stackoverflow though |
When I do this
item$
is not gonna beFirebaseObjectObservable
anymore, it's gonna be aAnonymousSubject
, without any of the Firebase methods (set()
etc.).It was supposedly fixed by #162 / #321 but it still seems to be broken.
I've seen people on SO using
list()
andquery
instead ofswitchMap
, but that doesn't seem right, what would be the point of obervable firebase wrapper if you couldn't use observable chains. But maybe I'm just doing something wrong, don't know. But if it's the case, I think it might be worth adding this usecase (id/key from angular' route param) to the docs, unless I'm blind and it's already there.Related questions / issues:
Version info
Angular: 4.1.3
Firebase: 4.0.0
AngularFire: 4.0.0.rc-1
rxjs: 5.4.0
cc @davideast
The text was updated successfully, but these errors were encountered: