#question Is it possible to enable <svg-icon> (component) globally?
Closed this issue · 2 comments
DKavaliou-by commented
I would like to declare AngularSvgIconModule only once in root AppModule to use it globally under all other subModules.
Is it possible?
czeckd commented
Declare the forRoot in the app's module. To use the svg-icon component, you will need to import it your other modules. So, app.module.ts:
import { HttpClientModule } from '@angular/common/http';
import { AngularSvgIconModule } from 'angular-svg-icon';
@NgModule({
imports: [ HttpClientModule, AngularSvgIconModule.forRoot() ],
...
})
export class AppModule {}
And in non-root module:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AngularSvgIconModule } from 'angular-svg-icon';
@NgModule({
declarations: [MyComponent],
imports: [
CommonModule,
AngularSvgIconModule
]
})
export class MyModule { }
I tried to emulate the usage model of Angular Material.
DKavaliou-by commented
Thanks for clarifying