【转】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 ...
随机推荐
- 1010 Radix (25)(25 point(s))
problem Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true ...
- BZOJ 2648 SJY摆棋子(KD树)
[题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=2716 [题目大意] 给出一些点,同时不断插入点和询问某点离插入点最近距离 [题解] 我 ...
- 【贪心】Codeforces Round #480 (Div. 2) C. Posterized
题意:让你对[0,255]这个序列任意划分成一些不重叠的子段,每个子段的大小不超过K.给你n个不超过255的数,让你将每个数替换成它所在子段的任意一个元素,使得最终这个n个数的序列的字典序最小. p[ ...
- 【10.11校内测试】【优先队列(反悔贪心)】【莫队】【stl的应用??离线处理+二分】
上次做过类似的题,原来这道还要简单些?? 上次那道题是每天可以同时买进卖出,所以用两个优先队列,一个存买进,一个存卖出(供反悔的队列). 这道题实际上用一个就够了???但是不好理解!! 所以我还是用了 ...
- Express浅析
一.Express是什么? 首先Express是一个Node.js的Web框架,它的API使用各种HTTP实用程序方法和中间件,快速方便地创建强大的API,性能方面Express提供精简的基本web应 ...
- Codeforces Round #254 (Div. 1) C. DZY Loves Colors 分块
C. DZY Loves Colors 题目连接: http://codeforces.com/contest/444/problem/C Description DZY loves colors, ...
- 传智播客PHP面试题宝典开放下载
上下卷面试题更新完毕,一部让菜鸟4k+入职的 面试题宝典 http://php.itcast.cn/news/20130806/11490333788.shtml php视频教程 下载 http:// ...
- GDB 自动化操作的技术-PYTHON
https://github.com/spacewander/debugger-utils http://python.jobbole.com/85415/ https://segmentfault. ...
- blurImage做图片模糊处理报错free(): invalid next size
$image = new Imagick($url); $image->blurImage($x, $y); 调用blurImage($x, $y)函数报错: 原因是:原来的图片是CMYK的是印 ...
- WP8.1 VS iOS VS Android全方面大比拼
众所周知,苹果的OS和谷歌的Android系统都有着相对成熟的设计和较好的用户体验,而随着WP8.1的发布,微软WP系统在交互方面也有了很多改进和提升,而今天小编便为大家全面对比一下这三大系统. ...