docs: change wrong default app module by ng new (#38549)

In bootstrapping.md the default AppModule has some extra imports which are not generated
by default in ng new removed those extra imports and add them at appropriate place.

PR Close #38549
This commit is contained in:
Ajit Singh 2020-08-21 07:08:36 +05:30 committed by Misko Hevery
parent 984ed39195
commit fdd4fa0009
2 changed files with 11 additions and 8 deletions

View File

@ -21,11 +21,13 @@ import { ItemDirective } from './item.directive';
ItemDirective ItemDirective
], ],
// #enddocregion declarations // #enddocregion declarations
// #docregion imports
imports: [ imports: [
BrowserModule, BrowserModule,
FormsModule, FormsModule,
HttpClientModule HttpClientModule
], ],
// #enddocregion imports
providers: [], providers: [],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })

View File

@ -18,8 +18,6 @@ When you use the [Angular CLI](cli) command `ng new` to generate an app, the def
/* JavaScript imports */ /* JavaScript imports */
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
@ -29,9 +27,7 @@ import { AppComponent } from './app.component';
AppComponent AppComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule
FormsModule,
HttpClientModule
], ],
providers: [], providers: [],
bootstrap: [AppComponent] bootstrap: [AppComponent]
@ -120,9 +116,6 @@ Now you could use your `ItemDirective` in a component. This example uses `AppMod
Remember, components, directives, and pipes belong to one module only. You only need to declare them once in your app because you share them by importing the necessary modules. This saves you time and helps keep your app lean. Remember, components, directives, and pipes belong to one module only. You only need to declare them once in your app because you share them by importing the necessary modules. This saves you time and helps keep your app lean.
{@a imports} {@a imports}
## The `imports` array ## The `imports` array
@ -130,6 +123,12 @@ Remember, components, directives, and pipes belong to one module only. You only
The module's `imports` array appears exclusively in the `@NgModule` metadata object. The module's `imports` array appears exclusively in the `@NgModule` metadata object.
It tells Angular about other NgModules that this particular module needs to function properly. It tells Angular about other NgModules that this particular module needs to function properly.
<code-example
path="bootstrapping/src/app/app.module.ts"
region="imports"
header="src/app/app.module.ts (excerpt)">
</code-example>
This list of modules are those that export components, directives, or pipes This list of modules are those that export components, directives, or pipes
that 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`, `AppComponent`, which references components, directives, or pipes in `BrowserModule`,
@ -138,6 +137,8 @@ A component template can reference another component, directive,
or pipe when the referenced class is declared in this module or or pipe when the referenced class is declared in this module or
the class was imported from another module. the class was imported from another module.
{@a bootstrap-array} {@a bootstrap-array}
## The `providers` array ## The `providers` array