DEV Community

Discussion on: Angular: Using custom made SVG icons through Angular Material

Collapse
 
elasticrash profile image
Stefanos Kouroupis

No, this service registers the icons, it doesn't load any of them, until the view ultimately requests for one.

But yes, it registers all icons regardless if they are used or not.
and its quite easy to see that, if you create an interceptor and log all requests going through it, you will see requests on the svg files only when the view requests them.

Collapse
 
florianleitgeb profile image
Florian Leitgeb

What side effects does the registration have?
I am concerned about loading times and registration should not have a lot of impact to it. It feels somewhat wrong to register them globally and not only per lazy loaded module.

Thread Thread
 
elasticrash profile image
Stefanos Kouroupis

I don't think there is match of an impact since the only thing that addSvgIcon does is add an entry on a Map Object.

github.com/angular/components/blob...

You can always create a method that registers icons on demand. Personally, I don't think you will gain much by doing that, apart from over complicating your solution.