【转】Understanding the Angular Boot Process
原文: https://medium.com/@coderonfleek/understanding-the-angular-boot-process-9a338b06248c
---------------------------------------------------------------------------------
For newcomers to Angular 2+ (now referred to simply as Angular), the struggle is always adapting to the drastic change from the structure they are already familiar with in AngularJS. And for those that have never seen AngularJS but began their Angular journey with the new kid on the block, the fact that Angular includes a bootstrap process can send a rather unpleasant but rather misguided tone that Angular just decided to be a black sheep among its counterparts (as if favoring Typescript was not enough).
However, these misconceptions only arise when you have not fully understood the inner workings of Angular. When you fully understand it you will realize and start to appreciate its structure and rather than seeing it has “complex” you see it as highly organized.
In this short article (one of many devoted to demystifying the structure of Angular), i will break down the Angular bootstrap process, simply put, how an angular app starts up.
Then entry point to every Angular application is the main.ts
file which contains this last line:
The platformBrowserDynamic()
part of this line of code indicates that we are about to boot Angular in a browser environment. As Angular can be used in Javascript host environments asides the browser (e.g. on the server or in a web worker), its thus imperative that we specify the environment in which our App is to be booted.
The bootstrapModule()
function helps bootstrap our root module taking in the root module as its argument.
AppModule
is our root module which is the entry module for our application, this can actually be any of the modules in our application but by convention AppModule
is used as the root module.
In our AppModule, we then need to specify the component that will serve as the entry point component for our application. This happens in our app.module.ts
file where we import the entry component (conventionally AppComponent
) and supply it as the only item in our bootstrap
array inside the NgModule
configuration object.
And there you have it, that concludes our Angular boot process. A recap of the steps
- Specify the enviroment in which your Angular App is running
- Use the
bootstrapModule()
function to boot your entry module by supplying the module as an argument. - Inside the root module, specify your entry point component in the module configuration object.
Now that doesn’t look complicated does it :).
【转】Understanding the Angular Boot Process的更多相关文章
- The Boot Process at a Glance x86/x64系统启动过程解析
哥又来干体力活了.人肉翻译一下: The Boot Process at a Glance This section explains the boot process in sufficient d ...
- Ubuntu 16.04 启动错误 "a start job is running for hold until boot process finishes up"
老司机也差点翻船... 升级16.04的时候,将默认启动管理器(default display manager)选为gm3(gnome3)了(应该使用默认的lightgm)如果改成gm3,好像是nvi ...
- The Kernel Boot Process.内核引导过程
原文标题:The Kernel Boot Process 原文地址:http://duartes.org/gustavo/blog/ [注:本人水平有限,只好挑一些国外高手的精彩文章翻译一下.一来自己 ...
- [archlinux] linux boot process/order/stage
信息量好大 --! 神教读物,无人能比: https://wiki.archlinux.org/index.php/Arch_boot_process IBM的高质量文档 https://www.ib ...
- In Depth : Android Boot Sequence / Process
In Depth : Android Boot Sequence / Process What happened when I press power on button in my Android ...
- A Guide to the Multiboot Process
A Guide to the Multiboot Process The XP and Vista boot process in general.The Windows dual and multi ...
- Microsoft Windows CE 5.0 Board Support Package, Boot Loader, and Kernel Startup Sequence
Summary Learn about the initial, low-level startup sequence and the hardware platform functions that ...
- Angular vs React---React-ing to change
这篇文章的全局观和思路一级棒! The Fairy Tale Cast your mind back to 2010 when users started to demand interactive ...
- Kernel boot options
There are three ways to pass options to the kernel and thus control its behavior: When building the ...
随机推荐
- windows下nodejs+npm+bower+git+bootstrap组件环境配置
1.进入nodejs官方网站下载软件(nodejs.org), 2.下载完成后,双击默认安装.安装程序会自动添加环境变量 3.检测nodejs是否安装成功.打开cmd命令行 输入 node - v 显 ...
- 「HNOI2018」毒瘤
「HNOI2018」毒瘤 解题思路 先考虑只有一棵树的情况,经典独立集计数. \[ dp[u][0]=\prod (dp[v][0]+dp[v][1]) \\ dp[u][1]=\prod dp[v] ...
- XP下安装Centos 6.4 双系统 :Linux系统分区及挂载点,关键引导程序启动设置
一.关于Linux的分区情况 虽然硬盘分区表中最多能存储四个分区,但我们实际使用时一般只分为两个分区,一个是主分区(Primary Partion)一个是扩展分区(extended partition ...
- bzoj1503 Splay 维护名次数,支持删除
题目:http://www.lydsy.com/JudgeOnline/problem.php?id=1503 题解: 维护一颗Splay和一个外部变量,树中每个节点表示一个人,节点权值a + 外部变 ...
- HDU 5690 All X 数学
All X 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5690 Description F(x,m) 代表一个全是由数字x组成的m位数字.请计算, ...
- Jmeter实现对mysql的增、删、改、查
1. 创建一个存储过程,语句如下: DELIMITER $$; DROP PROCEDURE IF EXISTS test; create PROCEDURE test() BEGI ...
- 前些日子用css画的大白
闲来无事用css画的一个大白...其实有一些地方偷懒了用svg去画的,因为用纯几何形状组合去画变化那么复杂的曲线不太现实.但svg曲线坐标还是自己一点点调出来的,没有用工具生成. ps:点击身体的某些 ...
- DotNet_Performance_Tuning_ANTS_Performance_Profiler
http://www.cnblogs.com/parry/archive/2013/01/04/DotNet_Performance_Tuning_ANTS_Performance_Profiler. ...
- HDOJ 4876 ZCC loves cards
枚举组合,在不考虑连续的情况下推断能否够覆盖L...R,对随机数据是一个非常大的减枝. 通过检測的暴力计算一遍 ZCC loves cards Time Limit: 4000/2000 MS (Ja ...
- JEECG第二期深入使用培训(报名截止2014-06-21)
JEECG第二期深入使用培训(报名截止2014-06-21) JEECG深度研究-交流碰撞火花,你学会的不不过JEECG,很多其它的是软件架构思想 http://www.jeecg.org/forum ...