使用模态的angular js中的弹出窗口不工作

使用模态的angular js中的弹出窗口不工作,angular,bootstrap-modal,Angular,Bootstrap Modal,我正在构建一个基本的angular应用程序,其中需要有一个按钮,单击该按钮将打开一个弹出窗口并显示图表 这是我的按钮,它应该呈现弹出窗口 <div style="padding-top:50px;padding-left:10px;"> <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal" > Diagnose </button&

我正在构建一个基本的angular应用程序,其中需要有一个按钮,单击该按钮将打开一个弹出窗口并显示图表

这是我的按钮,它应该呈现弹出窗口

<div style="padding-top:50px;padding-left:10px;">
<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal" >
Diagnose
</button>
</div>

诊断
这是我的弹出窗口代码

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" style="width:1140px;height:601px;left:70px;top:80px;border-radius:0px;">
<div class="modal-dialog" role="document" style="width:1140px;height:601px;margin:0px;border-radius:0px;">
<div class="modal-content" style="border-radius:0px;">
<div class="modal-header" style="padding: 18px 30px 18px 30px;">
<p class="modal-title" id="exampleModalLabel" style="font-size:24px;color:#434343;float:left;">Correlation Plot</p>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="float:right;">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body" style="width:1140px;height:523px;overflow-y:auto;">
<div class="corrBox">

<span><p class="cardText">Top 4 correlated features with Parent Satisfaction</p></span>
</div>
<div class="corrInfoBox" >
<canvas baseChart height="80px"
[datasets]="corr_barChartData"
[labels]="['']"
[options]="corr_barChartOptions"
[legend]=true
[chartType]="corr_barChartType"></canvas>
</div>
</div>
</div>
</div>
</div>

相关图

&时代;

与家长满意度相关的四大特征

问题是,在屏幕上显示绘图时,甚至没有单击“诊断”按钮,而单击“诊断”按钮时,什么也没有发生


如何链接“我的诊断”按钮以在弹出窗口中显示条形图?

您的按钮和弹出窗口都是同一父组件的一部分。 因此,假设您具有以下条件:

  • 当前页面组件
    • 钮扣
    • 弹出
您的代码将被设计成这样
currentPage.component.html

按钮文本

请记住,您需要将弹出组件的模块添加到当前页面的模块中


如果您的问题和代码结构更清晰,我们可以提供更多信息。

我建议使用基于角度的库,如and或or
currentPage.component.ts

public openPopup() {
     // your logic goes here
}