Modal Component guide and example throw exceptions

Bug description:

The Modal as a component plnkr linked from the guide doesn’t work when you click the button. It throws the exception:

Error in src/modal-component.html:3:47 caused by: No component factory found for NgbdModalContent

I’m actually getting the same error in my own code, not experienced enough with Angular2 yet to be able to figure out how to fix it.

Plnkr:

https://ng-bootstrap.github.io/app/components/modal/demos/component/plnkr.html

Version of Angular, ng-bootstrap, and Bootstrap:

Angular: 2.0.2

ng-bootstrap: 1.0.0-alpha.8

Bootstrap: 4.0.0-alpha.4

1 possible answer(s) on “Modal Component guide and example throw exceptions

  1. in the lazy module. we need reimport the NgbModule,just like root module.

    @NgModule({
        imports: [
            CommonModule,
            FormsModule,
            NgbModule.forRoot(),
            routing
        ],
        providers: [I18nService],
        declarations: [I18nComponent,
            ListComponent, StartComponent, ProjectComponent, ModuleComponent,
            CustomModalContent],
        entryComponents:[CustomModalContent]
    })
    export class I18nModule {
    }
    

    then it is working
    but i don`t known why!!!