Comments (3)
Hi, thanks for the report!
Yes, so this is a bit of a quirk with the injector that is particularly noticeable when mixing the two approaches as the hierarchy works a bit differently in MgModule components and standalone components - I should perhaps add some documentation detailing this.
The best option is just use provideIcons
in any components that needs icons and import the NgIcon component there. This also has the nice benefit of being more efficient when lazy loading components as the icons get loaded with the component.
@Component({
standalone: true,
imports: [ButtonModule, ShellModule, NgIcon],
template: '<ng-icon name="tablerCompass" />',
viewProviders: [provideIcons({ tablerCompass })]
})
export class ShellComponent {}
If you still have issues let me know and I can look into it further - and if so if you are able to provide a StackBlitz/CodeSandbox reproducing the issue that would be very helpful. Thanks
from ng-icons.
I'm going to close this issue for now - if you have any further queries or issues let me know and I'll be happy to help. Thanks
from ng-icons.
@ashley-hunter , thanks for your fast response.
I already tried to import NgIcon and then using viewProviders. Sadly, this did not change anything. I ended up converting the custom ui-Library to standalone. This was a lot of work but made everything work. However, this solution is not feasible for developers handling large libraries or where they do not have control over them.
I'm sorry that I cannot provide a StackBlitz example since there is no sharable version of my code and constructing the example would take more time than I could justify to invest.
Thanks for your insights though.
from ng-icons.
Related Issues (20)
- Icon library request: tdesign-icons HOT 1
- tdesign icons non resizable HOT 1
- Ng test not working as expected with NgIconsModule HOT 3
- Icon library request: Phosphor Icons HOT 1
- Feature: Support for Materials Symbols HOT 6
- Icons don't load HOT 2
- How to set size for all icons? HOT 1
- Property '"name"' is incompatible with index signature. HOT 2
- feat: support loading icons using http HOT 13
- ProvideNgIconLoader doesnt work with ChangeDetection.OnPush HOT 2
- Angular 17 Question/Not Working HOT 3
- FontAwesome Pack UnAvailable? HOT 4
- Missing Fontawasome Icon Pack
- Angular17 Component not rendering HOT 3
- add iconsax HOT 4
- Problem with inline styling due to not passing the CSP HOT 6
- Mismatched solid/outlined icons for matForwardToInbox HOT 1
- Feature Request: Support throwing error for missing icon HOT 1
- @angular/ssr: NullInjectorError: No provider for InjectionToken Icons Token! HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ng-icons.