What does the @Injectable({ providedIn: 'root' }) decorator do?
- A Creates a new instance per component
- B Registers the service as an application-wide singleton that is tree-shakable
- C Prevents the service from being injected
- D Registers it only in lazy-loaded modules
Answer
Registers the service as an application-wide singleton that is tree-shakable
providedIn root gives one instance for the whole application and allows the service to be dropped from the bundle if nothing injects it.





