You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aio/content/guide/aot-metadata-errors.md
+7-7
Original file line number
Diff line number
Diff line change
@@ -110,7 +110,7 @@ export class MyComponent {}
110
110
111
111
The compiler generates the component factory, which includes the `useValue` provider code, in a separate module. _That_ factory module can't reach back to _this_ source module to access the local (non-exported) `foo` variable.
Copy file name to clipboardExpand all lines: aio/content/guide/architecture-components.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -87,7 +87,7 @@ Angular inserts an instance of the `HeroListComponent` view between those tags.
87
87
88
88
*`providers`: An array of [providers](guide/glossary#provider) for services that the component requires. In the example, this tells Angular how to provide the `HeroService` instance that the component's constructor uses to get the list of heroes to display.
Every Angular app has at least one NgModule class, [the *root module*](guide/bootstrapping), which is conventionally named `AppModule` and resides in a file named `app.module.ts`. You launch your app by *bootstrapping* the root NgModule.
*`providers`: Creators of [services](guide/architecture-services) that this NgModule contributes to the global collection of services; they become accessible in all parts of the app. (You can also specify providers at the component level, which is often preferred.)
*`bootstrap`: The main application view, called the *root component*, which hosts all other app views. Only the *root NgModule* should set the `bootstrap` property.
@@ -109,7 +109,7 @@ When Angular creates a new instance of a component class, it determines which se
109
109
110
110
When Angular discovers that a component depends on a service, it first checks if the injector has any existing instances of that service. If a requested service instance doesn't yet exist, the injector makes one using the registered provider, and adds it to the injector before returning the service to Angular.
* By default, the Angular CLI command [`ng generate service`](cli/generate) registers a provider with the root injector for your service by including provider metadata in the `@Injectable()` decorator. The tutorial uses this method to register the provider of HeroService class definition.
* When you register a provider with a [specific NgModule](guide/architecture-modules), the same instance of a service is available to all components in that NgModule. To register at this level, use the `providers` property of the `@NgModule()` decorator,
* Components use *services*, which provide specific functionality not directly related to views. Service providers can be *injected* into components as *dependencies*, making your code modular, reusable, and efficient.
Copy file name to clipboardExpand all lines: aio/content/guide/cheatsheet.md
+8-8
Original file line number
Diff line number
Diff line change
@@ -55,7 +55,7 @@
55
55
56
56
<p>Defines a module that contains components, directives, pipes, and providers.</p>
57
57
58
-
<p>定义一个模块,其中可以包含组件、指令、管道和服务提供商。</p>
58
+
<p>定义一个模块,其中可以包含组件、指令、管道和服务提供者。</p>
59
59
60
60
</td>
61
61
@@ -120,7 +120,7 @@ is available to <code>declarations</code> of this module.</p>
120
120
121
121
<p>List of dependency injection providers visible both to the contents of this module and to importers of this module.</p>
122
122
123
-
<p>依赖注入提供商的列表,本模块以及本模块导入的所有模块中的内容都可以看见它们。</p>
123
+
<p>依赖注入提供者的列表,本模块以及本模块导入的所有模块中的内容都可以看见它们。</p>
124
124
125
125
</td>
126
126
@@ -617,7 +617,7 @@ is available to <code>declarations</code> of this module.</p>
617
617
618
618
<p>Declares that a class can be provided and injected by other classes. Without this decorator, the compiler won't generate enough metadata to allow the class to be created properly when it's injected somewhere.</p>
0 commit comments