Skip to content

FirebaseObjectObservable after using a switchMap #1008

@fxck

Description

@fxck

When I do this

  key$ = this._activatedRoute.params.pluck('key');
  item$: FirebaseObjectObservable<Client> = this.key$.switchMap(
    (key) => this._db.object(`/client/${key}`)
  );

item$ is not gonna be FirebaseObjectObservable anymore, it's gonna be a AnonymousSubject, 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() and query instead of switchMap, 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions