<div *ngIf="httpdata=='success' && res==true ?fun():''">
</div>
fun() {
//alert("hi")
$(document).ready(function () {
// Attach Button click event listener
$("#edit-submit").click(function () {
// show Modal
$('#myModal').modal('show');
});
});
this.res = false;
}
我已经使用了上面的代码。单击按钮后,将通过 web api 发送 json 数据,插入数据后,响应消息将是“成功”。如果响应成功,它应该在模态弹出窗口中显示消息 该数据已成功提交。 它没有显示任何弹出窗口,也没有错误。
最佳答案
我推荐你使用 ng bootstrap https://ng-bootstrap.github.io/#/home
并阅读有关模态实现的部分: https://ng-bootstrap.github.io/#/components/modal/examples
希望对您有所帮助。
关于javascript - 如果条件在 Angular 8 中为真,如何显示模态弹出窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57123904/