Skip to content

Can we use props as observables? #75

@dietergeerts

Description

@dietergeerts

Hi, we are currently investigating switching to Vue.js from AngularJS and I don't see a way to use props as observables. This is what we have currently (with https://github.com/cvuorinen/angular1-async-filter):

<child my-attribute="$ctrl.myAttribute$ | async : this">
</child>

and then inside the child:

{{$ctrl.myAttribute}}

(The parent also got myAttribute$ injected with an attribute from ui-router)

The thing is that myAttribute$ can change, so it could be switched out with another observable. In AngularJS, the async filter (pipe) handles this for us, but from what I can see in the docs of vue-rx, there is no way to do this?

The only thing I think would work is using $watchAsObservable('myAttribute$').pipe(switchAll()) in the parent and then use that to inject into the child, but imho this use-case should be part of this solution, because it also needs to handle cases where the observable itself is undefined etc....

Any ideas?

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