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

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.

主站蜘蛛池模板: 固阳县| 武功县| 海林市| 积石山| 盘锦市| 左权县| 诸城市| 久治县| 海林市| 垦利县| 光山县| 东乡族自治县| 秦皇岛市| 潮安县| 容城县| 依安县| 太和县| 丰县| 宁阳县| 开阳县| 秦皇岛市| 铜山县| 兰溪市| 泗洪县| 盱眙县| 离岛区| 伊宁县| 滦平县| 高雄县| 湛江市| 宣城市| 拉萨市| 威远县| 威海市| 镇沅| 安仁县| 桃园县| 万载县| 东港市| 凤山县| 宣武区|