DEV Community

Discussion on: RxJS Subjects in Depth

Collapse
 
gc_psk profile image
Giancarlo Buomprisco

Hi Yehonatan, interesting question!

Do you have a use-case in mind? Without knowing exactly the scenario, I think you don't need a Subject in such case, you should create an Observable creator and push values from the inside?

Collapse
 
yoni333 profile image
yehonatan yehezkel • Edited

Etc in angular when the observablenis in a service but you push values from the component after user clicks.
.
what is the best practice to push values from inside into observable?

Thread Thread
 
gc_psk profile image
Giancarlo Buomprisco

The only way for that is to create a new Observable using new Observable(Observer) - where you define the source inside the observable and you push values/errors/completion with Observer.next, error and complete. Hope this helps!