From c3643615fcef0ce978af062e6b06cc9f2978221a Mon Sep 17 00:00:00 2001 From: Alan Date: Wed, 17 Oct 2018 14:58:11 +0200 Subject: [PATCH] docs: replace `alert-is-helpful` with `alert is-helpful` (#26497) PR Close #26497 --- aio/content/guide/dependency-injection-providers.md | 10 +++++----- aio/content/guide/dependency-injection.md | 8 ++++---- aio/content/guide/deployment.md | 4 ++-- aio/content/guide/hierarchical-dependency-injection.md | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/aio/content/guide/dependency-injection-providers.md b/aio/content/guide/dependency-injection-providers.md index 54219a0db8..302ed985c5 100644 --- a/aio/content/guide/dependency-injection-providers.md +++ b/aio/content/guide/dependency-injection-providers.md @@ -147,7 +147,7 @@ In TypeScript, an interface is a design-time artifact, and doesn't have a runtim -
+
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. @@ -180,7 +180,7 @@ 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. @@ -293,7 +293,7 @@ When you provide multiple sets of routes using [RouterModule.forRoot](api/router 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. @@ -309,7 +309,7 @@ When providers are tree-shakable, the Angular compiler removes the associated services from the final output when it determines that they are not used in your application. This significantly reduces the size of your bundles. -
+
Ideally, if an application isn't injecting a service, it shouldn't be included in the final output. However, Angular has to be able to identify at build time whether the service will be required or not. @@ -346,7 +346,7 @@ The service can be instantiated by configuring a factory function, as in the fol -
+
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/dependency-injection.md b/aio/content/guide/dependency-injection.md index d4a78df080..d768f46d22 100644 --- a/aio/content/guide/dependency-injection.md +++ b/aio/content/guide/dependency-injection.md @@ -9,7 +9,7 @@ DI is a coding pattern in which a class asks for dependencies from external sour In Angular, the DI framework provides declared dependencies to a class when that class is instantiated. This guide explains how DI works in Angular, and how you use it to make your apps flexible, efficient, and robust, as well as testable and maintainable. -
+
You can run the of the sample app that accompanies this guide. @@ -52,7 +52,7 @@ replace every use of the `HEROES` mock data. The DI framework lets you supply data to a component from an injectable _service_ class, defined in its own file. To demonstrate, we'll create an injectable service class that provides a list of heroes, and register that class as a provider of that service. -
+
Having multiple classes in the same file can be confusing. We generally recommend that you define components and services in separate files. @@ -238,7 +238,7 @@ If Angular can't find that parameter information, it throws an error. Angular can only find the parameter information _if the class has a decorator of some kind_. The `@Injectable()` decorator is the standard decorator for service classes. -
+
The decorator requirement is imposed by TypeScript. TypeScript normally discards parameter type information when it [transpiles](guide/glossary#transpile) the code to JavaScript. TypeScript preserves this information if the class has a decorator and the `emitDecoratorMetadata` compiler option is set `true` in TypeScript's `tsconfig.json` configuration file. The CLI configures `tsconfig.json` with `emitDecoratorMetadata: true`. @@ -295,7 +295,7 @@ When using `@Optional()`, your code must be prepared for a null value. If you don't register a logger provider anywhere, the injector sets the value of `logger` to null. -
+
`@Inject()` and `@Optional()` are _parameter decorators_. They alter the way the DI framework provides a dependency, by annotating the dependency parameter on the constructor of the class that requires the dependency. diff --git a/aio/content/guide/deployment.md b/aio/content/guide/deployment.md index 7882b86f94..ef84a518bb 100644 --- a/aio/content/guide/deployment.md +++ b/aio/content/guide/deployment.md @@ -47,7 +47,7 @@ Make a note of the user name and project name in GitHub. You can see your deployed page at `https://.github.io//`. -
Check out [angular-cli-ghpages](https://github.com/angular-buch/angular-cli-ghpages), a full featured package that does all this for you and has extra functionality. @@ -283,7 +283,7 @@ Configure the Angular Router to defer loading of all other modules (and their as or by [_lazy loading_](guide/router#asynchronous-routing "Lazy loading") them on demand. -
#### Don't eagerly import something from a lazy-loaded module diff --git a/aio/content/guide/hierarchical-dependency-injection.md b/aio/content/guide/hierarchical-dependency-injection.md index 9267e20f91..0ca7cd6e89 100644 --- a/aio/content/guide/hierarchical-dependency-injection.md +++ b/aio/content/guide/hierarchical-dependency-injection.md @@ -25,7 +25,7 @@ When you specify providers in the `@Injectable()` decorator of the service itsel You're likely to inject `UserService` in many places throughout the app and will want to inject the same service instance every time. Providing `UserService` through the `root` injector is a good choice, and is the default that the [Angular CLI](cli) uses when you generate a service for your app. -
+
Platform injector
When you use `providedIn:'root'`, you are configuring the root injector for the _app_, which is the injector for `AppModule`.