Giter VIP home page Giter VIP logo

Comments (3)

ashley-hunter avatar ashley-hunter commented on May 13, 2024

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.

ashley-hunter avatar ashley-hunter commented on May 13, 2024

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.

JayStolzenwald avatar JayStolzenwald commented on May 13, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.