8
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Angular: No component factory found for ~. Did you add it to @NgModule.entryComponents?

Last updated at Posted at 2018-10-03

Angularの開発にて、新規コンポーネント(モーダル)を追加しようとして以下のようなエラーに遭遇。

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

解決方法

文字通り、app.module.tsの記載漏れでした。

module.ts
@NgModule({
  imports: [
    ・・・
  ],
  declarations: [
    TestModal
  ],
  entryComponents: [
    TestModal
  ],
  providers: [
    ・・・
 ]
})

module追加の場合は、exportsにも追記する必要があるようです。

module.ts
  exports: [ TestModule ],

参考

stack overflow: Angular 4: no component factory found,did you add it to @NgModule.entryComponents?

8
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?