简体   繁体   中英

When and for which component is the DOM created in Angular?

Does each Angular component have its own DOM? Or is it only one DOM for the index.html , and only the component selector inside the index.html have their template elements in the DOM?

Here's the trick:

Create an angular app, create a few components, use them in the app and Run the app:

You can check the actual DOM of the entire page by inspecting the page on your browser under Elements tab.

I had already done that and the result is:

Every component you're seeing on the screen is part of the actual DOM. So basically, though not sure but I am assuming based on my checks, All components are part of the index.html DOM.

I have tested this by viewing the ELements of the angular.io site and I found that every component displayed on the screen is part of the DOM.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM