I have short question. I have this code in a service:
newChartConfig = new Subject()
newChartConfigAction$ = this.newChartConfig.asObservable()
And use it in this a component like this:
this.areaChartCacheService.newChartConfigAction$.pipe(
map((x: any) => {
this.yrange = x.yrange;
this.xrange = x.xrange;
})
).subscribe(
() => console.log('complete LiineChart')
)
But so my question is:
is it necessary to do asObservable?
Because Subject is already observable.
Thank you
Because if I remove asObservable it still works
And after it is used like this:
async getObjectFromStore(id) {
const db = await openDB<CaDB>('ca-state', 1)
await db.get('ca-widgets', id).then(
result => {
this.newChartConfig.next(result)
this.newChartParams.next(result.params)
}
);
}