Angular bootstrap的一个例子
生活随笔
收集整理的這篇文章主要介紹了
Angular bootstrap的一个例子
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
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.
例子:
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的內容:
<!doctype html> <html lang="en"> <head><meta charset="utf-8"><title>MyFirstProject</title><base href="/"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="icon" type="image/x-icon" href="favicon.ico"> </head> <body><app-root></app-root> </body> </html>這個app-root的標簽:
定義在app.component.ts的Component selector里:
要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":
總結
以上是生活随笔為你收集整理的Angular bootstrap的一个例子的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 摩托罗拉 razr 40 Ultra 手
- 下一篇: 链路聚合的三种方式分别是什么(华三H3C