zoukankan      html  css  js  c++  java
  • 【转】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

    1. Specify the enviroment in which your Angular App is running
    2. Use the bootstrapModule() function to boot your entry module by supplying the module as an argument.
    3. Inside the root module, specify your entry point component in the module configuration object.

    Now that doesn’t look complicated does it :).

  • 相关阅读:
    10.汇编语言--伪指令(offset、prt、lengthof)
    9.汇编语言--算数运算,标记寄存器
    8.汇编语言--数据传输指令mov等
    7.汇编语言--定义数据类型、数组
    6.汇编语言--汇编基本元素、寄存器、内存初步调试
    5.汇编语言--输入输出
    4.汇编语言--更为简便的使用win32-api
    3.汇编语言--x86处理器架构
    微信小程序获取input输入框里面的value值
    学习微信小程序遇到的坑 ---跳转
  • 原文地址:https://www.cnblogs.com/oxspirt/p/9815511.html
Copyright © 2011-2022 走看看