官术网_书友最值得收藏!

Angular app directives

AngularJS allowed declarative bootstrapping the application using the ng-app directive. But, Angular doesn't support declarative bootstrapping. It supports only bootstrapping the application explicitly by calling the bootstrap function and passing the root component of the application.

AngularJS:

<body ng-app="packtPub"> 

Angular:

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 
import { AppModule } from './app/app.module'; 
platformBrowserDynamic().bootstrapModule(AppModule); 

Notice that in AngularJS, the Angular module name packtPub has been assigned to the ng-app directive. However, in Angular, we pass AppModule to the bootstrap module as per the execution environment. Notice that AppModule is the NgModule class, which is the root module of the application that we just bootstrapped as per the execution environment.

主站蜘蛛池模板: 安新县| 光泽县| 临汾市| 天镇县| 武鸣县| 西华县| 东乌珠穆沁旗| 肇州县| 岢岚县| 平顶山市| 万荣县| 胶南市| 镇沅| 兴城市| 海阳市| 达孜县| 威海市| 常宁市| 罗甸县| 云和县| 枝江市| 梁河县| 雷州市| 黎平县| 上高县| 延津县| 富顺县| 洪湖市| 溧阳市| 基隆市| 石阡县| 邓州市| 五原县| 通海县| 丹江口市| 莲花县| 阿尔山市| 德钦县| 梅河口市| 墨竹工卡县| 泰州市|