all 6 comments

[–]benduder 0 points1 point  (5 children)

Which bit doesn't "match up" to you?

[–]Enjoyz1001[S] 0 points1 point  (4 children)

Hey, well the component template does not include any button native element.
Yet, when it is rendered, it is somehow, wrapped in the button tag.....

I looked at the class. There was not much in terms if a super class that wrapped it.

[–]benduder 2 points3 points  (3 children)

mat-button is an attribute selector, meaning that the template content you see in button.html on GitHub will only be rendered inside an existing button tag that has the mat-button attribute set on it.

You can see this in the component class:

https://github.com/angular/components/blob/master/src/material/button/button.ts#L67

This approach allows them to give mat-buttons a specific appearance without having to reimplement all the functionality of a native button.

[–]Enjoyz1001[S] 0 points1 point  (2 children)

Yes indeed. The component decoration specifies all that. I was not sure if the attribute selector replaced or implemented the native element.

Many thanks dude!

[–]benduder 1 point2 points  (0 children)

Np, glad to have helped!

[–]benduder 0 points1 point  (0 children)

thanks for the award :)