BsModalModule错误TS2339:类型“ BsModalModule”上不存在属性“打开”

时间:2018-07-26 18:14:59

标签: angular angular5

目前,我正在学习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'.

如何解决此错误?

0 个答案:

没有答案