我正在尝试在我的主页上创建一个弹出框。所以我创建了以下功能..
public presentPopover(myEvent) {
let popover = this.popoverCtrl.create(TestComponent);
popover.present({
ev: myEvent
});
}
在我的 homepage.module.ts 中,我添加了 testComponent 作为入口组件。
import { TestModule } from './../../components/test/test.module';
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { HomePage } from './home';
import { TestComponent } from './../../components/test/test';
@NgModule({
declarations: [
HomePage,
],
imports: [
TestModule,
IonicPageModule.forChild(HomePage),
],
entryComponents: [
TestComponent,
]
})
但是当我单击该弹出按钮时,我仍然收到此错误。
ERROR Error: Uncaught (in promise): Error: No component factory found for TestComponent. Did you add it to @NgModule.entryComponents?
Error: No component factory found for TestComponent. Did you add it to @NgModule.entryComponents?
at noComponentFactoryError (core.js:3786)
at CodegenComponentFactoryResolver.resolveComponentFactory (core.js:3850)
at PopoverCmp._load (popover-component.js:41)
at PopoverCmp.ionViewPreLoad (popover-component.js:33)
而且我很困惑为什么要将此添加到条目组件中?