这是我的模型Pop Up的角度代码,
<form #addNewItem="ngForm" (ngSubmit)="onNewItemCreate(addNewItem.form.valid)">
<div class="modal" id="addNewItem" role="dialog" ng-show="addNewModelShow">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Add New Item</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
.......
.......
这就是我显示此弹出窗口的方式,
<a class="dropdown-item add-link" data-toggle="modal" data-target="#addNewItem">
我在Typescript上具有项创建功能,在我的函数中,当Item插入成功时,我想关闭弹出式模型(来自Typescript)
onNewItemCreate(isValid: boolean) {
......
......
if(itemCreatedSuccess) {
// I want to close pop up here
} else {
....
}
}
我已经尝试过
addNewModelShow = false
,但没有用。
答案 0 :(得分:0)
答案 1 :(得分:0)
如果您希望从控制器端关闭模式,则可以使用这种方式
$("#addNewItem").modal("hide");