Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Angular Application Run? which file executes first?

Are main.ts and index.html runs parallelly? if no, which file runs first? if main.ts, then how angular knows that it should display index.html in browser?

like image 939
rupesh prajapati Avatar asked Nov 30 '25 03:11

rupesh prajapati


1 Answers

https://dev.to/casperns/how-angular-trigger-indexhtml-and-start-working-1l46

  • Angular started with main.ts.
  • Then we bootstrap an angular application and we pass app.module.ts as an argument. In app.module.ts we tell angular: "There is the app component which you should know when you try to start yourself".
  • And angular now analyze this app component, reading the set up we pass there and there is SELECTOR app-root.
  • Now, angular is enable to handle app-root in the index.html and knows rules for the SELECTOR.
  • SELECTOR should insert the app components and have some HTML code - a template attached to him - html component.
  • This is how Angular application starts.
like image 175
PierreD Avatar answered Dec 02 '25 17:12

PierreD



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!