michaelbazos / angular-feather

A-la-carte integration of Feather Icons in Angular applications
MIT License
155 stars 38 forks source link

NullInjectorError: No provider for Icons #48

Closed koficypher closed 2 years ago

koficypher commented 2 years ago

Node V: 14.17.0 Npm V: 6.14.13 NG CLI: 12 Feather Icon: 6.1.0 OS: Windows

I have a feature module called Core Module that has components for the layout of my application. Such components are imported into a layout module for different layout styles for the application. Feather icons is imported into the Core module because the sidebar makes use of them. Now when i run ng serve or npm start i get the this error: ERROR NullInjectorError: R3InjectorError(AppModule)[Icons -> Icons -> Icons]: NullInjectorError: No provider for Icons

Now by this i understand that one of my imports i.e. the Feather Icon module is missing a provider but it isnt clear where i need to provide this class or service and which particular class i need to provide.

echle commented 2 years ago

I dont think its a problem of the library but maybe I missunderstand your usecase.

You will need to import the FeatherModule in each module you are using them. Usually you establish something like a sharedModule, that imports and exports such commonly used modules. So you would need to import the shared module into you core module and your layout module.

michaelbazos commented 2 years ago

@koficypher it sounds like you had an issue in the configuration.

Make sure that your Core Module calls FeatherModule.pick(...) as in the readme documentation, and exports FeatherModule it as well. Or better, create a module specifically for icons, import it in modules that rely on it.

sandeep18051989 commented 2 years ago

when you are planning to launch feather package compatible with angular >13

michaelbazos commented 2 years ago

@sandeep18051989 It has been released, please see version library versions >= 6.2.0