> A way to initialize and launch an app or system.
In Angular, an app's root NgModule (AppModule) has a bootstrap property that identifies the app's top-level components.
例子:
```TypeScript
import { BrowserModule } from '@angular/platform-browser';import { NgModule } from '@angular/core';import { AppRoutingModule } from './app-routing.module';import { AppComponent } from './app.component';@NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, AppRoutingModule ], providers: [], bootstrap: [AppComponent]})export class AppModule { }
其中bootstrap屬性的值AppComponent來自檔案app.component.ts:
> During the bootstrap process, Angular creates and inserts these components into the index.html host web page.
index.html的內容:
這個app-root的標籤:
定義在app.component.ts的Component selector裡:
最新評論
延伸閱讀