- Expert Angular
- Mathieu Nayrolles Rajesh Gunasundaram Sridhar Rao
- 109字
- 2021-07-15 17:05:36
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.
推薦閱讀
- Docker and Kubernetes for Java Developers
- 潮流:UI設(shè)計(jì)必修課
- Python語(yǔ)言程序設(shè)計(jì)
- Scala Design Patterns
- JMeter 性能測(cè)試實(shí)戰(zhàn)(第2版)
- Mastering matplotlib
- 基于差分進(jìn)化的優(yōu)化方法及應(yīng)用
- 深度學(xué)習(xí):算法入門與Keras編程實(shí)踐
- 軟件工程
- Android開發(fā)案例教程與項(xiàng)目實(shí)戰(zhàn)(在線實(shí)驗(yàn)+在線自測(cè))
- iOS開發(fā)實(shí)戰(zhàn):從入門到上架App Store(第2版) (移動(dòng)開發(fā)叢書)
- Serverless computing in Azure with .NET
- OpenGL Data Visualization Cookbook
- C語(yǔ)言程序設(shè)計(jì)
- Visual Basic程序設(shè)計(jì)全程指南