Bootstrapping the module for the browser - lordoftheflies/angular-essential-training GitHub Wiki
With an Angular root module and a starting component created the next step to getting the foundation of an Angular app up and running is the code to bootstrap the module. We can use a file named main.ts in the app folder and put the bootstrap logic in this file. Angular actually has support for running on multiple platforms. The browser is considered a platform. The server and web worker are examples of other platforms. Other third-party bootstraps could also be used to provide support on other platforms. For this app, we are targeting the browser. So we need to bootstrap for that platform. Angular exports a function named platform browser dynamic that can be used for targeting the browser. And that comes from the platform browser dynamic scope package. So we can import the platform browser dynamic function from there. This function returns a platform object that has a bootstrap module function on it. That is the function you will use to bootstrap your route module on the platform. Note that earlier we were importing class types and here we are importing a function. The module loading syntax supports importing all kinds of exported things from class types and functions to constants, variables and even Json file data. Okay, so now we can make the call to the platform browser dynamic function, and off of that platform browser dynamic call, using a period, we can call bootstrap module. This function is expecting a root module and we have one already created from earlier named app module. We can pass the app module type into the bootstrap module function call here