【转】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 ...
随机推荐
- 深入理解mysql的自连接和join关联
一.mysql自连接 mysql有时在信息查询时需要进行对自身连接(自连接),所以我们需要为表定义别名.我们举例说明,下面是商品采购表,我们需要找到采购价格比惠惠高的所有信息. 一般情况我们看到这张表 ...
- djongo form.is_valid 返回false的解决方法
在用djongo编写网站时,有时点击提交按钮之后,并未提交,通过debug会发现是form.is_valid()返回false造成的.但是,具体原因往往并不容易找. 这时在提交的html中添加如下代码 ...
- android 不失真 显示 超高清 图片 长图
韩梦飞沙 韩亚飞 313134555@qq.com yue31313 han_meng_fei_sha 通过计算 位图工厂.选项 对象的 inSamleSize 值 等比压缩 图片. 使用 ...
- 【状压dp】Petrozavodsk Winter Training Camp 2018 Day 1: Jagiellonian U Contest, Tuesday, January 30, 2018 Problem E. Guessing Game
题意:给你n个两两不同的零一串,Alice在其中选定一个,Bob去猜,每次询问某一位是0 or 1.问你最坏情况下最少要猜几次. f(22...2)表示当前状态的最小步数,2表示这位没确定,1表示确定 ...
- UploadFileUtil
package cn.tz.util.file; import java.io.File; import java.io.FileOutputStream; import java.io.InputS ...
- oracle开发学习篇之集合运算符以及集合异常捕获
--取出集合;长度 declare type list_nested ) not null; v_all list_nested := list_nested('a','b','c','d','c', ...
- Git_操作标签
如果标签打错了,也可以删除: $ git tag -d v0.1 Deleted tag 'v0.1' (was e078af9) 因为创建的标签都只存储在本地,不会自动推送到远程.所以,打错的标签可 ...
- Ubuntu下(Linux+Apache+MYSQL+PHP, LAMP)环境搭建
近期開始玩PHP,于是试着搭建一下开发环境并做个记录,以备日后再使用起来方便可查. 第一步 确保软件包是最新的 sudo apt-get update 第二步 安装Apache2 sudo apt-g ...
- 用最简单的例子理解观察者模式(Observer Pattern)
假设有一个软件公司,每当有新产品推出,就把信息通知到一些客户. 把通知这个动作抽象成一个接口. public interface IService { void Notif(); } 客户如果想获得通 ...
- 使用jquery加载部分视图01-使用$.get()
使用Html.RenderParital或Html.RenderAction可以在主视图中加载部分视图. 两种方法是有区别的,在"RenderPartial和RenderAction区别&q ...