Angular2: Error – No component factory found. Did you add it to @NgModule.entryComponents?

Standard

I was trying to integrate Angular Material 2 in my side Angular2 project, suddenly from now where I saw this error popping up while including Dialog material component into my module.

 No component factory found for TestDialog. Did you add it to @NgModule.entryComponents?

screenshot_3

Solution:

Place components which are created dynamically to entryComponents under @NgModuledecorator function.

@NgModule({
    imports: [
        FormsModule,
        CommonModule,
        DashbaordRoutingModule
    ],
    declarations: [
        MainComponent,
        TestDialog
    ],
    entryComponents: [
        TestDialog
    ]
})
Advertisements

2 thoughts on “Angular2: Error – No component factory found. Did you add it to @NgModule.entryComponents?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s