In my CRM system I have dashboards all over the place. For adding widget to dashboard I use modals.
I want to lazy load module that is responsible for adding modals.
I though it is possible since angular@9
but I think it is not :/
When I press propper button it executes this code:
openModal(): Observable<WidzetModel> {
const obs$ = from(
import('@app/widgets/widgets-add.module')
)
.pipe(
switchMap(resp => {
return this.modalService.open(ModalAddWidgetComponent)
.pipe(take(1));
}));
}
Module is lazy loaded but it is not initiated. For example none of providers are initiated:
@NgModule({
declarations: [],
imports: [],
providers: [
WidgetAddService
],
})
export class WidgetsAddModule {
}
So is it possible to lazy load modules outside router?