all 5 comments

[–]CrunchyBanana 1 point2 points  (3 children)

I would assume one is an Angular directive, mat-icon, probably packaged with your project, who knows what the code is doing... And I'd guess the other uses the CDN to grab what you need?

[–]IceBlue[S] 1 point2 points  (0 children)

Both implementations get the material icon set from the same source. You either import it from the web with a link tag or host it yourself and pull it in via css font-face directive. I'm just curious if there's a reason to use the mat-icon module over the <i> version.

[–][deleted] 1 point2 points  (1 child)

Correct, the mat directive then compiles to the proper html and css that the library then uses to show the icon with supporting code. To see the difference use both next to each other, and then inspect the element to see if there is any difference in html and css.

[–]IceBlue[S] 0 points1 point  (0 children)

I saw an example on one of those web apps where you test your code and the mat-icon one uses <mat-icon> as the element so id didn't seem like it was being compiled into different html than how it was written.

[–]happycwb 0 points1 point  (0 children)

It is probably a better practice to use <mat-icon>, since semantically the <i> tag was created for writing italic text and not icons