- 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.
推薦閱讀
- Learning Scala Programming
- Rake Task Management Essentials
- PyTorch Artificial Intelligence Fundamentals
- HTML+CSS+JavaScript編程入門指南(全2冊)
- C++ System Programming Cookbook
- Mastering Embedded Linux Programming
- Getting Started with JUCE
- Mastering ArcGIS Server Development with JavaScript
- Raspberry Pi Robotic Projects
- Java程序性能優化實戰
- 前端程序員面試筆試真題與解析
- 計算機輔助設計與繪圖技術(AutoCAD 2014教程)(第三版)
- Xamarin Cross-platform Application Development(Second Edition)
- Django 3 Web應用開發從零開始學(視頻教學版)
- Spark Cookbook