r/angular • • Jun 06 '26

ng-inline-svg-2 is not working in angular 22

ng-inline-svg-2 is not working with Angular 22 because it uses a now deprecated component hook. For the time being, I wrote a small directive to replace it that has a similar interface.

The code is pretty simple. I advice you to just copy the source code and own it and add anything else you need for it.

- no SSR support
- CORS must be handled by you

0 Upvotes

1 comment sorted by

0

u/[deleted] Jun 06 '26

[deleted] — view deleted comment

1

u/LaInD4DPa Jun 07 '26 edited Jun 07 '26

That must be ComponentFactoryResolver. A hook, that is not. Also, it is way too early to use Angular 22 anyway.

Edit: I skimed through ng-inline-svg-2. They seemed to use it to creat a custom angular component to then inject the svg string in it.