简单的确认模式

时间:2016-07-25 17:28:05

标签: angular bootstrap-modal

我想使用ng2 bs3模式来确认用户操作。 但我不知道如何从我的模态中获得回调。 例如:

@ViewChild('confirmModal') confirm: confirmModal;
deleteItem(){
    if(this.confirm.open()){
        delete
    }
    else{
        not delete
    }
}    

缩短模态代码

<button type="button" class="btn btn-default" data-dismiss="modal" (click)="modal.dismiss()">Cancel</button>
<button type="button" class="btn btn-primary" (click)="modal.close()">Ok</button>
export class confirmModal{
    close() {
        this.modal.close();
    }
    open(){
        this.modal.open()
    }
}

如何根据用户的选择返回true或false。 提前感谢您的回答。

0 个答案:

没有答案
相关问题