Skip to content

Commit

Permalink
docs: Minor fixes in NgModules section (#36177)
Browse files Browse the repository at this point in the history
Apply minor fixes to various guides of the NgModules section

PR Close #36177
  • Loading branch information
bampakoa authored and mhevery committed Aug 25, 2020
1 parent d066368 commit 9168919
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion aio/content/guide/architecture-modules.md
Expand Up @@ -17,7 +17,7 @@ An NgModule is defined by a class decorated with `@NgModule()`. The `@NgModule()

* `imports`: Other modules whose exported classes are needed by component templates declared in *this* 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.)
* `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.)

* `bootstrap`: The main application view, called the *root component*, which hosts all other app views. Only the *root NgModule* should set the `bootstrap` property.

Expand Down
6 changes: 2 additions & 4 deletions aio/content/guide/bootstrapping.md
Expand Up @@ -12,7 +12,7 @@ Every application has at least one Angular module, the _root_ module,
which must be present for bootstrapping the application on launch.
By convention and by default, this NgModule is named `AppModule`.

When you use the [Angular CLI](cli) command `ng new` to generate an app, the default `AppModule` is as follows.
When you use the [Angular CLI](cli) command `ng new` to generate an app, the default `AppModule` looks like the following:

```typescript
/* JavaScript imports */
Expand Down Expand Up @@ -90,8 +90,6 @@ A declarable can only belong to one module, so only declare it in
one `@NgModule`. When you need it elsewhere,
import the module that has the declarable you need in it.

**Only `@NgModule` references** go in the `imports` array.


### Using directives with `@NgModule`

Expand Down Expand Up @@ -133,7 +131,7 @@ The module's `imports` array appears exclusively in the `@NgModule` metadata obj
It tells Angular about other NgModules that this particular module needs to function properly.

This list of modules are those that export components, directives, or pipes
that the component templates in this module reference. In this case, the component is
that component templates in this module reference. In this case, the component is
`AppComponent`, which references components, directives, or pipes in `BrowserModule`,
`FormsModule`, or `HttpClientModule`.
A component template can reference another component, directive,
Expand Down
2 changes: 1 addition & 1 deletion aio/content/guide/feature-modules.md
Expand Up @@ -79,7 +79,7 @@ To incorporate the feature module into your app, you have to let the root module
<code-example path="feature-modules/src/app/app.module.ts" region="app-module" header="src/app/app.module.ts"></code-example>


Now the `AppModule` knows about the feature module. If you were to add any service providers to the feature module, `AppModule` would know about those too, as would any other feature modules. However, NgModules don’t expose their components.
Now the `AppModule` knows about the feature module. If you were to add any service providers to the feature module, `AppModule` would know about those too, as would any other feature modules. However, NgModules don’t expose their components by default.


## Rendering a feature module’s component template
Expand Down
6 changes: 3 additions & 3 deletions aio/content/guide/ngmodule-faq.md
Expand Up @@ -101,7 +101,7 @@ should import `BrowserModule` from `@angular/platform-browser`.
`BrowserModule` provides services that are essential to launch and run a browser app.

`BrowserModule` also re-exports `CommonModule` from `@angular/common`,
which means that components in the `AppModule` module also have access to
which means that components in the `AppModule` also have access to
the Angular directives every app needs, such as `NgIf` and `NgFor`.

Do not import `BrowserModule` in any other module.
Expand Down Expand Up @@ -140,7 +140,7 @@ declared in this NgModule.
You _can_ export any declarable class&mdash;components, directives, and pipes&mdash;whether
it's declared in this NgModule or in an imported NgModule.

You _can_ re-export entire imported NgModules, which effectively re-exports all of their exported classes.
You _can_ re-export entire imported NgModules, which effectively re-export all of their exported classes.
An NgModule can even export a module that it doesn't import.

<hr/>
Expand Down Expand Up @@ -192,7 +192,7 @@ Its only purpose is to add http service providers to the application as a whole.

The `forRoot()` static method is a convention that makes it easy for developers to configure services and providers that are intended to be singletons. A good example of `forRoot()` is the `RouterModule.forRoot()` method.

Apps pass a `Routes` object to `RouterModule.forRoot()` in order to configure the app-wide `Router` service with routes.
Apps pass a `Routes` array to `RouterModule.forRoot()` in order to configure the app-wide `Router` service with routes.
`RouterModule.forRoot()` returns a [ModuleWithProviders](api/core/ModuleWithProviders).
You add that result to the `imports` list of the root `AppModule`.

Expand Down
2 changes: 1 addition & 1 deletion aio/content/guide/ngmodules.md
Expand Up @@ -36,7 +36,7 @@ NgModule metadata does the following:
* Declares which components, directives, and pipes belong to the module.
* Makes some of those components, directives, and pipes public so that other module's component templates can use them.
* Imports other modules with the components, directives, and pipes that components in the current module need.
* Provides services that the other application components can use.
* Provides services that other application components can use.

Every Angular app has at least one module, the root module.
You [bootstrap](guide/bootstrapping) that module to launch the application.
Expand Down

0 comments on commit 9168919

Please sign in to comment.