Marwa
Marwa

Reputation: 321

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 theindex.html, and only the component selector inside the index.html have their template elements in the DOM?

Upvotes: 0

Views: 51

Answers (1)

Mosia Thabo
Mosia Thabo

Reputation: 4277

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.

Upvotes: 1

Related Questions