- 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.
推薦閱讀
- iOS Game Programming Cookbook
- Pandas Cookbook
- Mastering SVG
- 劍指JVM:虛擬機實踐與性能調優
- C# 從入門到項目實踐(超值版)
- OpenCV 3和Qt5計算機視覺應用開發
- 技術領導力:程序員如何才能帶團隊
- 區塊鏈:以太坊DApp開發實戰
- Visual Basic程序設計習題解答與上機指導
- Mastering Predictive Analytics with Python
- 硅谷Python工程師面試指南:數據結構、算法與系統設計
- 響應式架構:消息模式Actor實現與Scala、Akka應用集成
- ASP.NET程序開發范例寶典
- 從0到1:HTML5 Canvas動畫開發
- Mastering OAuth 2.0