` specify the token's purpose.
+
+Next, register the dependency provider in the component using the `InjectionToken` object of `APP_CONFIG`.
+
+
+
+Now you can inject the configuration object into the constructor with `@Inject()` parameter decorator.
+
+
+
+{@a di-and-interfaces}
+
+#### Interfaces and dependency injection
+
+Though the TypeScript `AppConfig` interface supports typing within the class, the `AppConfig` interface plays no role in dependency injection.
+In TypeScript, an interface is a design-time artifact, and doesn't have a runtime representation, or token, that the DI framework can use.
+
+When the transpiler changes TypeScript to JavaScript, the interface disappears because JavaScript doesn't have interfaces.
+
+Since there is no interface for Angular to find at runtime, the interface cannot be a token, nor can you inject it.
-
-
-This might seem strange if you're used to dependency injection in strongly typed languages where an interface is the preferred dependency lookup key.
-However, JavaScript, doesn't have interfaces, so when TypeScript is transpiled to JavaScript, the interface disappears.
-There is no interface type information left for Angular to find at runtime.
-
-
-
-One alternative is to provide and inject the configuration object in an NgModule like `AppModule`.
-
-
-
-Another solution to choosing a provider token for non-class dependencies is
-to define and use an `InjectionToken` object.
-The following example shows how to define such a token.
-
-
-
-The type parameter, while optional, conveys the dependency's type to developers and tooling.
-The token description is another developer aid.
-
-Register the dependency provider using the `InjectionToken` object:
-
-
-
-Now you can inject the configuration object into any constructor that needs it, with
-the help of an `@Inject()` parameter decorator.
-
-
-
-
-
-Although the `AppConfig` interface plays no role in dependency injection,
-it supports typing of the configuration object within the class.
-
-
-
{@a factory-provider}
{@a factory-providers}
-## Factory providers
+## Using factory providers
-Sometimes you need to create a dependent value dynamically,
-based on information you won't have until run time.
-For example, you might need information that changes repeatedly in the course of the browser session.
-Also, your injectable service might not have independent access to the source of the information.
+To create a changeable, dependent value based on information unavailable before run time, you can use a factory provider.
-In cases like this you can use a *factory provider*.
-Factory providers can also be useful when creating an instance of a dependency from
-a third-party library that wasn't designed to work with DI.
+In the following example, only authorized users should see secret heroes in the `HeroService`.
+Authorization can change during the course of a single application session, as when a different user logs in .
-For example, suppose `HeroService` must hide *secret* heroes from normal users.
-Only authorized users should see secret heroes.
-
-Like `EvenBetterLogger`, `HeroService` needs to know if the user is authorized to see secret heroes.
-That authorization can change during the course of a single application session,
-as when you log in a different user.
-
-Imagine that you don't want to inject `UserService` directly into `HeroService`, because you don't want to complicate that service with security-sensitive information.
-`HeroService` won't have direct access to the user information to decide
-who is authorized and who isn't.
-
-To resolve this, give the `HeroService` constructor a boolean flag to control display of secret heroes.
+To keep security-sensitive information in `UserService` and out of `HeroService`, give the `HeroService` constructor a boolean flag to control display of secret heroes.
-You can inject `Logger`, but you can't inject the `isAuthorized` flag. Instead, you can use a factory provider to create a new logger instance for `HeroService`.
-
-A factory provider needs a factory function.
+To implement the `isAuthorized` flag, use a factory provider to create a new logger instance for `HeroService`.
-Although `HeroService` has no access to `UserService`, the factory function does.
-You inject both `Logger` and `UserService` into the factory provider
-and let the injector pass them along to the factory function.
+The factory function has access to `UserService`.
+You inject both `Logger` and `UserService` into the factory provider so the injector can pass them along to the factory function.
-* The `useFactory` field tells Angular that the provider is a factory function whose implementation is `heroServiceFactory`.
+* The `useFactory` field specifies that the provider is a factory function whose implementation is `heroServiceFactory`.
* The `deps` property is an array of [provider tokens](guide/dependency-injection#token).
The `Logger` and `UserService` classes serve as tokens for their own class providers.
-The injector resolves these tokens and injects the corresponding services into the matching factory function parameters.
+The injector resolves these tokens and injects the corresponding services into the matching `heroServiceFactory` factory function parameters.
-Notice that you captured the factory provider in an exported variable, `heroServiceProvider`.
-This extra step makes the factory provider reusable.
-You can configure a provider of `HeroService` with this variable wherever you need it.
-In this sample, you need it only in `HeroesComponent`,
-where `heroServiceProvider` replaces `HeroService` in the metadata `providers` array.
+Capturing the factory provider in the exported variable, `heroServiceProvider`, makes the factory provider reusable.
-The following shows the new and the old implementations side-by-side.
+The following side-by-side example shows how `heroServiceProvider` replaces `HeroService` in the `providers` array.
@@ -241,115 +216,3 @@ The following shows the new and the old implementations side-by-side.
-## Predefined tokens and multiple providers
-
-Angular provides a number of built-in injection-token constants that you can use to customize the behavior of
-various systems.
-
-For example, you can use the following built-in tokens as hooks into the frameworkâs bootstrapping and initialization process.
-A provider object can associate any of these injection tokens with one or more callback functions that take app-specific initialization actions.
-
-* [PLATFORM_INITIALIZER](api/core/PLATFORM_INITIALIZER): Callback is invoked when a platform is initialized.
-
-* [APP_BOOTSTRAP_LISTENER](api/core/APP_BOOTSTRAP_LISTENER): Callback is invoked for each component that is bootstrapped. The handler function receives the ComponentRef instance of the bootstrapped component.
-
-* [APP_INITIALIZER](api/core/APP_INITIALIZER): Callback is invoked before an app is initialized. All registered initializers can optionally return a Promise. All initializer functions that return Promises must be resolved before the application is bootstrapped. If one of the initializers fails to resolves, the application is not bootstrapped.
-
-The provider object can have a third option, `multi: true`, which you can use with `APP_INITIALIZER`
-to register multiple handlers for the provide event.
-
-For example, when bootstrapping an application, you can register many initializers using the same token.
-
-```
-export const APP_TOKENS = [
- { provide: PLATFORM_INITIALIZER, useFactory: platformInitialized, multi: true },
- { provide: APP_INITIALIZER, useFactory: delayBootstrapping, multi: true },
- { provide: APP_BOOTSTRAP_LISTENER, useFactory: appBootstrapped, multi: true },
-];
-```
-
-Multiple providers can be associated with a single token in other areas as well.
-For example, you can register a custom form validator using the built-in [NG_VALIDATORS](api/forms/NG_VALIDATORS) token,
-and provide multiple instances of a given validator provider by using the `multi: true` property in the provider object.
-Angular adds your custom validators to the existing collection.
-
-The Router also makes use of multiple providers associated with a single token.
-When you provide multiple sets of routes using [RouterModule.forRoot](api/router/RouterModule#forroot)
-and [RouterModule.forChild](api/router/RouterModule#forchild) in a single module,
-the [ROUTES](api/router/ROUTES) token combines all the different provided sets of routes into a single value.
-
-
-
-Search for [Constants in API documentation](api?type=const) to find more built-in tokens.
-
-
-
-
-
-Note that the reference to the array returned for a `multi` provider is shared between all the
-places where the token is injected. We recommend avoiding mutations of the array (especially for
-predefined tokens) as it may lead to unexpected behavior in other parts of the app that inject
-the same token. You can prevent the value from being mutated by setting its type to `ReadonlyArray`.
-
-
-
-You can use `ReadonlyArray` to type your `multi` provider, so TypeScript triggers an error in case
-of unwanted array mutations:
-
-```
-constructor(@Inject(MULTI_PROVIDER) multiProvider: ReadonlyArray) {
-}
-```
-
-{@a tree-shakable-provider}
-{@a tree-shakable-providers}
-
-## Tree-shakable providers
-
-Tree shaking refers to a compiler option that removes code from the final bundle if the app doesn't reference that code.
-When providers are tree-shakable, the Angular compiler removes the associated
-services from the final output when it determines that your application doesn't use those services.
-This significantly reduces the size of your bundles.
-
-
-
-Ideally, if an application isn't injecting a service, Angular shouldn't include it in the final output.
-However, Angular has to be able to identify at build time whether the app will require the service or not.
-Because it's always possible to inject a service directly using `injector.get(Service)`,
-Angular can't identify all of the places in your code where this injection could happen,
-so it has no choice but to include the service in the injector.
-Thus, services in the NgModule `providers` array or at component level are not tree-shakable.
-
-
-
-The following example of non-tree-shakable providers in Angular configures a service provider for the injector of an NgModule.
-
-
-
-You can then import this module into your application module
-to make the service available for injection in your app,
-as in the following example.
-
-
-
-When `ngc` runs, it compiles `AppModule` into a module factory, which contains definitions for all the providers declared in all the modules it includes. At runtime, this factory becomes an injector that instantiates these services.
-
-Tree-shaking doesn't work here because Angular can't decide to exclude one chunk of code (the provider definition for the service within the module factory) based on whether another chunk of code (the service class) is used. To make services tree-shakable, the information about how to construct an instance of the service (the provider definition) needs to be a part of the service class itself.
-
-### Creating tree-shakable providers
-
-You can make a provider tree-shakable by specifying it in the `@Injectable()` decorator on the service itself, rather than in the metadata for the NgModule or component that depends on the service.
-
-The following example shows the tree-shakable equivalent to the `ServiceModule` example above.
-
-
-
-The service can be instantiated by configuring a factory function, as in the following example.
-
-
-
-
-
-To override a tree-shakable provider, configure the injector of a specific NgModule or component with another provider, using the `providers: []` array syntax of the `@NgModule()` or `@Component()` decorator.
-
-
diff --git a/aio/content/guide/hierarchical-dependency-injection.md b/aio/content/guide/hierarchical-dependency-injection.md
index 4c80545947..f1bde65a95 100644
--- a/aio/content/guide/hierarchical-dependency-injection.md
+++ b/aio/content/guide/hierarchical-dependency-injection.md
@@ -40,8 +40,8 @@ using and results in smaller bundle sizes.
Tree-shaking is especially useful for a library
because the application which uses the library may not have
a need to inject it. Read more
-about [tree-shakable providers](guide/dependency-injection-providers#tree-shakable-providers)
-in [DI Providers](guide/dependency-injection-providers).
+about [tree-shakable providers](guide/architecture-services#providing-services)
+in [Introduction to services and dependency injection](guide/architecture-services).
diff --git a/aio/content/guide/lightweight-injection-tokens.md b/aio/content/guide/lightweight-injection-tokens.md
index c401c6b917..cbaecee5ff 100644
--- a/aio/content/guide/lightweight-injection-tokens.md
+++ b/aio/content/guide/lightweight-injection-tokens.md
@@ -3,7 +3,7 @@
This page provides a conceptual overview of a dependency injection technique that is recommended for library developers.
Designing your library with *lightweight injection tokens* helps optimize the bundle size of client applications that use your library.
-You can manage the dependency structure among your components and injectable services to optimize bundle size by using [tree-shakable providers](guide/dependency-injection-providers#tree-shakable-providers).
+You can manage the dependency structure among your components and injectable services to optimize bundle size by using [tree-shakable providers](guide/architecture-services#introduction-to-services-and-dependency-injection).
This normally ensures that if a provided component or service is never actually used by the app, the compiler can eliminate its code from the bundle.
However, due to the way Angular stores injection tokens, it is possible that such an unused component or service can end up in the bundle anyway.
@@ -89,7 +89,7 @@ These effectively change `constructor(@Optional() other: OtherComponent)` to `co
-For all services, a library should use [tree-shakable providers](guide/dependency-injection-providers#tree-shakable-providers), providing dependencies at the root level rather than in component constructors.
+For all services, a library should use [tree-shakable providers](guide/architecture-services#introduction-to-services-and-dependency-injection), providing dependencies at the root level rather than in component constructors.
diff --git a/aio/content/guide/providers.md b/aio/content/guide/providers.md
index e9154c8506..a246b3b1ea 100644
--- a/aio/content/guide/providers.md
+++ b/aio/content/guide/providers.md
@@ -89,5 +89,5 @@ Register a provider with a component when you must limit a service instance to a
You may also be interested in:
* [Singleton Services](guide/singleton-services), which elaborates on the concepts covered on this page.
* [Lazy Loading Modules](guide/lazy-loading-ngmodules).
-* [Tree-shakable Providers](guide/dependency-injection-providers#tree-shakable-providers).
+* [Dependency providers](guide/dependency-injection-providers).
* [NgModule FAQ](guide/ngmodule-faq).