|
|
|
@ -7,6 +7,8 @@ import { |
|
|
|
StaticProvider, |
|
|
|
Type, |
|
|
|
} from '@angular/core'; |
|
|
|
import { filter, map } from 'rxjs/operators'; |
|
|
|
import { ConfigStateService } from '../services/config-state.service'; |
|
|
|
|
|
|
|
export class LazyModuleFactory<T> extends NgModuleFactory<T> { |
|
|
|
get moduleType(): Type<T> { |
|
|
|
@ -29,3 +31,11 @@ export class LazyModuleFactory<T> extends NgModuleFactory<T> { |
|
|
|
return factory.create(injector); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export function featuresFactory( |
|
|
|
configState: ConfigStateService, |
|
|
|
featureKeys: string[], |
|
|
|
mapFn: (features) => any = features => features, |
|
|
|
) { |
|
|
|
return configState.getFeatures$(featureKeys).pipe(filter(Boolean), map(mapFn)); |
|
|
|
} |
|
|
|
|