Engineering Full Stack Apps with Java and JavaScript
Angular is a single page application. Single page served by angular is index.html. Below is the structure of default index.html.
<app-root> is a tag present in index.html. How angular will know about this tag. That is taken care by main.ts which is the first script that will run. Below is the structure of main.ts
main.ts bootstrap AppModule
AppModule has declared a bootstarp array and AppComponent is added to it. So Angular should know this bootstrap component before trying to load index.html. Below is the AppComponent having <app-root> as the selector. So when angular see the same selector in index.html, it knows that the component to be loaded is app.component.html
Below is the code in app.component.html
So when we ran ng serve, the screen we see is app.component.html