concept Angular service in category angular

appears as: Angular service, Angular services, n Angular service
Angular Development with Typescript, Second Edition

This is an excerpt from Manning's book Angular Development with Typescript, Second Edition.

The ngOnDestroy() hook is invoked when a component gets destroyed. For example, when you use the router to navigate from component A to component B, component A gets destroyed, and component B is created. If you created an explicit subscription in component A, don’t forget to unsubscribe in ngOnDestroy(). This hook is also supported by Angular services.

The reducer can implement minimal app logic related to state change. For example, suppose a user decides to cancel an order, which requires a reset of certain fields on the state object. The main app logic remains in your application code (for example, in services) unless a concrete implementation of the Redux-inspired library offers a special place meant for code with side effects. In this chapter, we use the ngrx library, which suggests using Angular services combined with so-called effects that live outside of the store and that can aggregate Angular services working as a bridge between the store and services.