gpt4 book ai didi

javascript - 如果条件在 Angular 8 中为真,如何显示模态弹出窗口?

转载 作者:行者123 更新时间:2023-11-30 19:23:59 25 4
gpt4 key购买 nike

<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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com