我有这个文件
条形图card.component.ts
import { NgModule } from '@angular/core';
import { Component } from '@angular/core';
import { NbMenuService, NbSidebarService } from '@nebular/theme';
import { NbDialogService } from '@nebular/theme';
import { filter, map } from 'rxjs/operators';
import { DialogNamePromptComponent } from './detail-view.component';
@Component({
selector: 'ngx-bar-chart-card',
templateUrl: './bar-chart-card.component.html',
styleUrls: ['./bar-chart-card.component.scss']
})
export class BarChartCardComponent {
flipped = false;
cardSettingCtxMenu = [{ title: 'Profile' }, { title: 'Log out' }];
constructor(
private dialogService: NbDialogService,
private menuService: NbMenuService) {
}
ngOnInit() {
console.log("asasas");
this.menuService.onItemClick()
.pipe(
filter(({ tag }) => tag === 'my-context-menu'),
map(({ item: { title } }) => title),
)
.subscribe(title => this.open3());
}
toggleView() {
this.flipped = !this.flipped;
}
open3() {
console.log("================");
this.dialogService.open(DialogNamePromptComponent);
}
}
详细视图.component.ts
import { Component } from '@angular/core';
import { NbDialogRef } from '@nebular/theme';
@Component({
selector: 'ngx-detail-view',
templateUrl: './detail-view.component.html'
})
export class DialogNamePromptComponent {
constructor(protected ref: NbDialogRef<DialogNamePromptComponent>) {}
cancel() {
this.ref.close();
}
submit(name) {
this.ref.close(name);
}
}
电子商务.module.ts
import { BarChartCardComponent } from './bar-chart-card/bar-chart-card.component';
import { DialogNamePromptComponent } from './bar-chart-card/detail-view.component';
@NgModule({
imports: [
ThemeModule,
ChartModule,
NgxEchartsModule,
NgxChartsModule,
LeafletModule,
],
declarations: [
DialogNamePromptComponent,
BarChartCardComponent
],
providers: [
CountryOrdersMapService,
],
entryComponents: [BarChartCardComponent,DialogNamePromptComponent]
})
export class ECommerceModule { }
在这里,当我调用方法open3
时,我收到此错误:
未找到 的组件工厂
DialogNamePromptComponent
。你加进去了@NgModule.entryComponents
吗?