can anyone give me a clear idea, that which runs first, Index.html or main.ts?
If Index.html runs first.
point 1. Main.ts or better say Main.js (after transpilation) can't run by itself as it is a javascript file at the end, and Index.html file is the one that contains the main.js at the bottom before the closing body tag, obviously the webpack does all this.
Now, let's say from the configuration that is Angular.json file, the angular knows that Index is the main HTML file that should be served first.
Then again, as Main.js is unknown at this point, so there is no way that the angular would know about the root component. And it must throw an error while parsing <app-root></app-root> but it doesn't throw the error. This means, it already knows about app-root, which means Main.js is the entry point. But how is this possible, how a javascript file can be triggered without Html page?
first way:- Angular.json ---> Main.js--->Index.html (but how is this possible? who triggers Main.js?)
second way:- Angular.json--->Index.html---->Main.js (but then how do angular know about <app-root>??)