Skip to content
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

Can we use props as observables? #75

Open
dietergeerts opened this issue Mar 20, 2018 · 0 comments
Open

Can we use props as observables? #75

dietergeerts opened this issue Mar 20, 2018 · 0 comments

Comments

@dietergeerts
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant