Posted On: Mar 13, 2020
The BehaviorSubject is used to hold the values that are to be shared with other components. You can subscribe to data with the BehaviorSubject that needs to be shared with other components.
You can subscribe to the data using the Behavior Subject service as the following.
//inject service into a component dataService.data.subscribe(data => { //do whatever needs doing when data changes }) //update the value of data in the service dataService.updateData(newData);
Never Miss an Articles from us.
Latest Key features of Angular 6Added support for creating Custom Elements based on Angular Components. Animations: ex..
Ivy Renderer is the next generation renderer to serve the purpose of enhanced performance. The Ivy renderer decreases the bundle size and the loading time which improves the performance and moreover, ...
Bazel is a built tool introduced with the Angular 6 that is used extensively by Google. It is mainly used to optimize the angular compilation and improves the building and test on Angular apps. The C...