我试图在角度2的按钮点击时显示警告,但我正在
"没有为BSMessageModal找到组件工厂"
tables.component.html
<td><button (click)="onClick()">Issue</button></td>
tables.component.ts
import { Component, OnInit, ViewContainerRef, ViewEncapsulation} from '@angular/core';
import { Overlay, overlayConfigFactory } from 'angular2-modal';
import { Modal, BSModalContext } from 'angular2-modal/plugins/bootstrap';
@Component({
selector: 'app-tables',
templateUrl: './tables.component.html',
styleUrls: ['./tables.component.scss'],
providers: [Modal]
})
export class TablesComponent implements OnInit {
constructor(public modal: Modal) { }
ngOnInit() { }
onClick() {
this.modal.alert()
.size('lg')
.showClose(true)
.title('A simple Alert style modal window')
.body(`
<h4>Alert is a classic (title/body/footer) 1 button modal window that
does not block.</h4>
<b>Configuration:</b>
<ul>
<li>Non blocking (click anywhere outside to dismiss)</li>
<li>Size large</li>
<li>Dismissed with default keyboard key (ESC)</li>
<li>Close wth button click</li>
<li>HTML content</li>
</ul>`)
.open();
}
}
tables.module.ts
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { TablesComponent } from './tables.component';
import { TablesRoutingModule } from './tables-routing.module';
import { PageHeaderModule } from './../../shared';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; //To display Tabs
import { ModalModule } from 'angular2-modal';
import { BootstrapModalModule } from 'angular2-modal/plugins/bootstrap';
@NgModule({
imports: [
CommonModule,
TablesRoutingModule,
PageHeaderModule,
NgbModule.forRoot(), //To display Tabs
ModalModule.forRoot()
],
declarations: [TablesComponent],
entryComponents: [ BSMessageModal] //Tried this !!! but no use!
})
export class TablesModule { }
我尝试在我的tables.module的entryComponents中添加BSMessageModal,但我根本不使用这个类。
完整错误跟踪:
错误错误:找不到BSMessageModal的组件工厂。你有没有把它添加到@ NgModule.entryComponents?(...)
错误错误:未捕获(承诺):错误:找不到BSModalContainer的组件工厂。你有没有把它添加到@ NgModule.entryComponents?(...)