Loading topic
inject() function, and provider registration in detail. 6 min read@Injectable decorator does, what providedIn: 'root' means, and why this form is the default way to writ5 min readinject() function and constructor parameters. You will learn how each one works, where each one is allowed to run, and the errors you will hit most often.5 min readbootstrapApplication. It also assumes you have read the earlier chapters on @Injectable and on injecting with inject(). Here you will learn what a provider is, every place you can register one, and how th6 min readbootstrapApplication, and the earlier chapters on @Injectable, inject(), and registering providers. You will learn the four provider recipes Angular offers. You will see what each one creates, whe6 min readCartService works as its own lookup key: Angular sees the class reference, finds a provider for it, and returns an instance. Many things you want to inject are not classes, though. API base URLs, feature flags, retry limits, a window re6 min readprovidedIn: 'root' has one instance for the whole application. That suits caches, HTTP clients, and app-wide state. Some state belongs to a single part of the screen, though. Examples are a form draft, the selection inside one data grid, or the open/closed state of one ac6 min readinject() works, what providedIn: 'root' means, and the 6 min readuseClass, useValue, useFactory, and useExisting, and how to create and inject an InjectionToken. It also assumes you know the difference between environment injectors and element injectors. Those topics are covered in ear6 min readinject() in a component, how providers and factory providers work, and how element injectors differ from environment injectors. Signals and effect() show up in a few examples. You do not need to know them in depth.5 min readTestBed to build a test injector, how to swap real services for test doubles, and where substitution tends to go wr4 min read