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

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.

主站蜘蛛池模板: 铜川市| 马尔康县| 奇台县| 清原| 永定县| 达日县| 祁门县| 浠水县| 长宁县| 炎陵县| 茂名市| 江门市| 全椒县| 通辽市| 称多县| 宜春市| 新河县| 西城区| 福泉市| 聊城市| 垣曲县| 孟津县| 阿拉善盟| 会泽县| 东至县| 隆德县| 浙江省| 海宁市| 沅江市| 三都| 南城县| 翼城县| 方城县| 静海县| 青州市| 朝阳市| 宁津县| 东兴市| 台南市| 蒙山县| 呼和浩特市|