目前,我正在学习Angular 4应用程序;我正在尝试添加模型窗口以添加记录。为此,我在页面中创建了模型。另外,我已经从NPM安装了ng2-bs3-modal
软件包。我正在使用VS代码来实现Application。
我的组件类正在导入
的以下参考import { BsModalModule } from 'ng2-bs3-modal';
在myComponent
视图参考中进行如下调用:
the export class myComponent implements OnInit {
@ViewChild('modal') modal : BsModalModule;
添加数据的功能
adddata() {
this.dbops = DBOperation.create;
this.Frm.reset();
this.modal.open();
}
在HTML页面中。
<modal #modal>
my form code here.
</modal>
但是当我尝试运行项目时,出现此错误:
error TS2339: Property 'open' does not exist on type 'BsModalModule'.
如何解决此错误?