Skip to content

fix(modal): BsModalService cannot instantiate the component from lazy-loaded module. #3353

@zzJinux

Description

@zzJinux

Before opening an issue, please search for duplicates (opened and closed)
https://github.com/valor-software/ngx-bootstrap/issues
There's no need to open an issue here if you want to ask general question, use StackOverflow or Slack instead

Bug description or feature request:

BsModalService internally uses ComponentFactoryResolver, and BsModalService is designed to be provided to the root injector.
For current latest version (5.1.2) of angular, The CFR from the root cannot instantiate the component from lazy-loaded module. (See angular/angular#14324)

BsModalService should be able to handle this situation. By either adding a parameter that accepts CFR or implementing intermediate service which can retrieve proper CFR. (as used in ng-bootstrap)

Plunker/StackBlitz that reproduces the issue:

https://stackblitz.com/edit/ngx-bootstrap-playground-mtwpzg

Versions of ngx-bootstrap, Angular, and Bootstrap:

ngx-bootstrap: 2.0.0-rc.0

Angular: 5.1.2

Bootstrap: n/a

Build system: Angular CLI, System.js, webpack, starter seed:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions