question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

svg icon registration doesn't work on server platform

See original GitHub issue

Bug, feature request, or proposal:

Bug: svg icons doesn’t work on server.

What is the expected behavior?

It should work on server too.

What is the current behavior?

Icon registration is tightly coupled with DOM and depends on document to be available which breaks its compatibility with server platform.

What are the steps to reproduce?

Use svg icons on server platform.

What is the use-case or motivation for changing an existing behavior?

It feels quite normal to have svg icons work on server.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

@angular/material@beta.8

Is there anything else we should know?

Nope.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
freezycommented, Jan 11, 2018

Is server-side pre-rendering supposed to work? When I register icons, I provide an URL, which I’m pretty sure won’t resolve while pre-rendering, given there’s no server running. I tried nevertheless and I’m getting

Error retrieving icon:
ERROR [Error]

for each icon I’m trying to render. Build runs through though (without icons obviously). Looks like the error is triggered here.

Would it be possible to retrieve the files from the file system when isPlatformServer() is true so pre-rendering works? Or am I missing something on my side?

1reaction
Toxicablecommented, Sep 7, 2017

@FadySamirSadek unlikely, since platform-server uses domino see https://github.com/fgnass/domino

Read more comments on GitHub >

github_iconTop Results From Across the Web

When accessing web application images don't load - SVG ...
When accessing Web Application behind BIG-IP, images/icons fail to load on your application even after applying the workaround iRule in KB ...
Read more >
angular, unable to dynamically load custom mat-icon with ...
You can register your custom icons as material icons. ... You iterate each item in data result and set input [svgIcon] for mat-icon...
Read more >
Solved: SVG Icon not displaying - Microsoft Power BI Community
Solved: I have imported a set of SVG icons into Powerbi, to use as conditional formatting. Added the code to the JSON file,...
Read more >
5 Gotchas You're Gonna Face Getting Inline SVG Into ...
Gotcha One: Missing the Target. In order to achieve caching using an external SVG file (you seriously don't want to dump ~1.5kb *...
Read more >
Optimising SVG load with Service Worker - Blog - Clicktorelease
This is a legacy post, ported from the old system: Images might be too low quality, code might be outdated, and some links...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found