add module import checks
This commit is contained in:
parent
e4cd12c17f
commit
442d79e9ce
@ -1,4 +1,4 @@
|
||||
import { ModuleWithProviders, NgModule } from '@angular/core';
|
||||
import { ModuleWithProviders, NgModule, Optional } from '@angular/core';
|
||||
import { FullPageLoadingIndicatorComponent } from './full-page-loading-indicator/full-page-loading-indicator.component';
|
||||
import { ProgressLoadingComponent } from './progress-loading/progress-loading.component';
|
||||
import { LoadingService } from './loading.service';
|
||||
@ -17,6 +17,12 @@ const components = [FullPageLoadingIndicatorComponent, ProgressLoadingComponent,
|
||||
imports: [MatProgressSpinnerModule, CommonModule, MatProgressBarModule, MatIconModule, TranslateModule],
|
||||
})
|
||||
export class IqserLoadingModule {
|
||||
constructor(@Optional() loadingService: LoadingService) {
|
||||
if (!loadingService) {
|
||||
throw new Error('Call forRoot() in AppModule to use IqserLoadingModule');
|
||||
}
|
||||
}
|
||||
|
||||
static forRoot(): ModuleWithProviders<IqserLoadingModule> {
|
||||
return {
|
||||
ngModule: IqserLoadingModule,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ModuleWithProviders, NgModule } from '@angular/core';
|
||||
import { Inject, ModuleWithProviders, NgModule, Optional } from '@angular/core';
|
||||
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
|
||||
import { pruningTranslationLoaderFactory } from './http-loader-factory';
|
||||
@ -22,6 +22,12 @@ const translateLoaderToken = 'translateLoader';
|
||||
exports: [TranslateModule],
|
||||
})
|
||||
export class IqserTranslateModule {
|
||||
constructor(@Optional() @Inject(translateLoaderToken) translateLoader: TranslateLoader) {
|
||||
if (!translateLoader) {
|
||||
throw new Error('Call forRoot() in AppModule to use IqserTranslateModule');
|
||||
}
|
||||
}
|
||||
|
||||
static forRoot(options?: IqserTranslateModuleOptions): ModuleWithProviders<IqserTranslateModule> {
|
||||
return {
|
||||
ngModule: IqserTranslateModule,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user