Back to all posts

Component selectors in Angular


When building component you notice unwanted element render in HTML like this Image:

That not a problem nor it will break you app but having cleaner html structure is good right?

Let look at how we can avoid those elements.

We can use component selectors to overcome this situation.

Similar Example with <ng-content />

Here we are using select attribute to add icon to button otherwise we have to add we not able to add two span tag in ng-content.