-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix(module): updated type on module.
- Loading branch information
Showing
1 changed file
with
12 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,27 @@ | ||
import { NgModule, ModuleWithProviders, Optional } from '@angular/core'; | ||
import { BootstrapIcons } from './ng-bootstrap-icons.component'; | ||
import { Icons } from './icons.provider'; | ||
|
||
import { NgModule, ModuleWithProviders, Optional } from "@angular/core"; | ||
import { BootstrapIcons } from "./ng-bootstrap-icons.component"; | ||
import { Icons } from "./icons.provider"; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
BootstrapIcons | ||
], | ||
exports: [ | ||
BootstrapIcons | ||
] | ||
declarations: [BootstrapIcons], | ||
exports: [BootstrapIcons], | ||
}) | ||
export class BootstrapIconsModule { | ||
constructor( | ||
@Optional() private icons: Icons | ||
) { | ||
if ( !this.icons ) { | ||
constructor(@Optional() private icons: Icons) { | ||
if (!this.icons) { | ||
throw new Error( | ||
`No icon provided. Make sure to use 'BootstrapIconsModule.pick({ ... })' when importing the module\n` + | ||
`Refer to documentation on https://github.com/biutas/ng-bootstrap-icons/issues` | ||
`Refer to documentation on https://github.com/biutas/ng-bootstrap-icons/issues` | ||
); | ||
} | ||
} | ||
|
||
static pick(icons: {[key: string]: string}): ModuleWithProviders { | ||
static pick(icons: { | ||
[key: string]: string; | ||
}): ModuleWithProviders<BootstrapIconsModule> { | ||
return { | ||
ngModule: BootstrapIconsModule, | ||
providers: [ | ||
{ provide: Icons, multi: true, useValue: icons } | ||
] | ||
providers: [{ provide: Icons, multi: true, useValue: icons }], | ||
}; | ||
} | ||
} |