providedIn Strategies
Compare providedIn: 'root', 'platform', 'any', and explicit module/component providers.
providedIn is the metadata property on @Injectable() that tells Angular where in the injector hierarchy a service should be registered, and it's also what enables tree-shaking — a service that's never actually injected anywhere in the final build can be dropped entirely, which wasn't possible with the older pattern of listing providers explicitly in an NgModule's providers array, since the bundler couldn't safely prove those services were unused.
providedIn: 'root' is like one shared company printer everyone in the building uses; providedIn: 'any' is like giving each satellite office its own printer instead, while still following the same shared company purchasing policy.