Angular Services
https://www.pluralsight.com/courses/services-angular
by Jim Cooper
- Creating Custom Angular Services
- Why Are Angular Services Necessary?
- The Single Responsibility Principle
- Cloning Our Demo Project
- Exploring Our Demo Project
- Creating an Angular Service
- Injecting and Using Services
- Cross-component Communication with Services
- Creating Reactive and Asynchronous Angular Services
- The Need for Reactivity in Angular Services
- Using RxJS for Reactivity
- Using Angular Signals for Reactivity
- Improving Service Encapsulation
- how to create a readonly signal
- Configuring Angular Projects to Work with APIs
- Calling APIs from an Angular Service
- Using the Async Pipe
- Understanding Angular Dependency Injection
- What Is Dependency Injection?
- Benefits of Dependency Injection
- Example Implementations of Dependency Injection
- Angular Dependency Injection
- Angular Service Providers
- What Are Service Providers and Injectors?
- How Providers Affect Instantiation
- Using Classes as Provider Tokens
- Creating useFactory() Providers
- Using Providers to Create Multiple Service Instances
- if you want unique instances of a service in a module, you must lazily load that module
- Challenges with Providing Services Using Interfaces
- Interfaces cannot be used as provider tokens
- Creating a Configurable Cart
- Creating useValue() Providers
- Supplying Provider Dependencies (deps)
- Using the multi Property
- Angular Service Injectors
- What Are Service Injectors?
- How Angular's Hierarchical Injectors Work
- Every Angular application has at minimum three injectors
- Configuring Injectors
- A Graphical Look at Injectors
- providing services at the component level affects that component and all of its children components
- Eagerly loaded modules and lazily loaded modules will traverse the injector tree differently; Lazily loaded modules get their own module injector while eagerly loaded modules won’t.
- Defining Component-level Providers
- Using interface for dependencies is not a best practice in Angular
- Resolution Modifiers: @Self(), @SkipSelf(), @Host() and @Optional()
- @Self() means the component needs to provide its own instance.
- @SkipSelf() is the opposite of @Self().
- Standalone Projects: Route-level Injectors and Providers
- In standalone components, you can provide services in router (because there is no module)
- Standalone Projects: Application-wide Providers ░
Comments
Post a Comment