-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add NG0403.md for Bootstrapped NgModule doesn't specify which c…
…omponent to initialize error (#48483) - update `errors.ts` to annotate the error NG0403, so that the runtime can add a link to that guide when an error is thrown - update `application_ref_spec.ts` to include the new link of the error - update `errors.md` as a result of running `yarn bazel test packages/core/test` Fixes #47985 PR Close #48483
- Loading branch information
1 parent
3944aa7
commit c5a8485
Showing
4 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
@name Bootstrapped NgModule doesn't specify which component to initialize | ||
@category runtime | ||
@shortDescription An NgModule that was used for bootstrapping does not specify which component should be initialized. | ||
|
||
@description | ||
This error means that an NgModule that was used for bootstrapping an application is missing key information for Angular to proceed with the bootstrap process. | ||
|
||
The error happens when the NgModule `bootstrap` property is missing (or is an empty array) in the `@NgModule` annotation and there is no `ngDoBootstrap` lifecycle hook defined on that NgModule class. | ||
|
||
More information about the bootstrapping process can be found in [this guide](guide/bootstrapping). | ||
|
||
The following examples will trigger the error. | ||
|
||
```typescript | ||
@NgModule({ | ||
declarations: [AppComponent], | ||
imports: [BrowserModule, AppRoutingModule], | ||
providers: [], | ||
}) | ||
export class AppModule {} | ||
|
||
// The `AppModule` is used for bootstrapping, but the `@NgModule.bootstrap` field is missing. | ||
platformBrowser().bootstrapModule(AppModule); | ||
``` | ||
|
||
```typescript | ||
@NgModule({ | ||
declarations: [AppComponent], | ||
imports: [BrowserModule, AppRoutingModule], | ||
providers: [], | ||
bootstrap: [], | ||
}) | ||
export class AppModule {} | ||
|
||
// The `AppModule` is used for bootstrapping, but the `@NgModule.bootstrap` field contains an empty array. | ||
platformBrowser().bootstrapModule(AppModule); | ||
``` | ||
|
||
@debugging | ||
Please make sure that the NgModule that is used for bootstrapping is setup correctly: | ||
- either the `bootstrap` property exists (and contains a non-empty array) in the `@NgModule` annotation | ||
- or the `ngDoBootstrap` method exists on the NgModule class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters