我想使用模式弹出窗口。它向我显示// // appmodule / appcomponent host.ngfactory.js此页面。(为空)
user.html
<div >
<button data-toggle="modal" mat-raised-button="primary" (click)=display()>Display Student</button>
</div>
<app-display></app-display>
user.ts
declare var $:any;
(<any>$('#modal-display')).modal('show');
display.html
<div class="modal fade" id='modal-display'>
<p>list works!</p>
</div>
它应该弹出另一个HTML窗口。但这向我显示错误是'未定义$'并显示此空白页 ng /// appmodule / appcomponent host.ngfactory.js sm
答案 0 :(得分:0)
您可能遇到的问题是因为您尚未在应用程序中安装jQuery
软件包。运行命令进行安装-
npm i jquery --save
PS:建议不要将 jQuery 与Angular一起使用。有很多选项,例如Primeng的Dialog,Mat对话框,ng-bootstrap Dialog等,您都可以使用。