The child component. The problem seemed to be that the array reference doenβt change when I change the state of the observable. It was an asynchronous problem. But I fixed it calling NgZone into constructor and using the function this.zone.run() into the callback function of the subcription. And filtering the null values, as you show in your tutorial.
Hi @Hongbo_Miao, iβm a bit confused as what the suggested method for subscribing to data in services is now? I followed your method at the top of this page which worked really well but iβve switched over to using the new observables and iβm struggling to get it working smoothly.
Would you be able to provide a similar break down to the one on this page but with the new observables? I would like to know the recommended method for subscribing to data that returns a single object as well as data that returns an array of objects.
In the tutorial all the data is loaded from within the component, but Angular suggests loading the data from a service. I was hoping for a comprehensive example of how to do it this way
Here getExamplesStatic() relies on the subscription in the constructor. You can add an autorun() call to have examples updated automatically.
The other function getExamplesDynamic does its own subscription since it can be different every time it is called. We return a custom observable here with the fetched values from the ObservableCursor as soon as the subscription is done.
Maybe this can be made simpler, but it works.