Hello. Thanks for providing this Forum.
I have studied a few Angular2 tutorials on YouTube, but am very curious:
How does the browser know which Angular2 Application to run when an HTML page is loaded from the Server into the browser ? There must be some meta-data somewhere that creates an association between the html page being loaded, and the AngularJS2 application that reacts to the page. Right ? Or am I going in the wrong direction ?
I guess you are confused because you don't know how the Webpack bundler (Angular CLI uses it) works. In chapter 10 of our book, we explain how to configure the Webpack manually: configure the entry points, split the code into multiple bundles and include them into index.html. Angular CLI generates the config files (and the main entry point of the app) automatically based on the information in the angular-cli.json.
When you run ng serve, all this magic happens in memory and you can't see the link between the index.html located in the src dir and the bundle(s). But if you run the ng build command, it'll create the folder dist, puts the new version of index.html and the bundles there. Open the file dist/index.html and you'll see the script tags that explicitly mention the bundles with the app.