保存时关闭 ng-Bootstrap 模式
Close ng-Bootstrap Modal on save
保存功能成功后如何关闭 ng-bootstrap 模式?
这是我目前的情况:
save(form, activeModal) {
this.goalsService.createNewGoal(this.team_id, form.value, this.date_created, this.date_modified)
.subscribe(
() => {
form.reset();
activeModal.dismiss('Successfully created Goal');
},
err => alert(`error creating goal ${err}`)
);
}
原来这是一个非常简单的修复。我需要做的就是将 activeModal.dismiss('Successfully created Goal');
更改为 this.activeModal.dismiss('Successfully created Goal');
使用NgbModal
服务打开模态时,会returnNgbModalRef
实例。
使用 returned 实例我们可以关闭或关闭模态。
loginModel : NgbModalRef;
constructor(private modalService:NgbModal) {}
onOpen(){
this.loginModel = this.modalService.open(content);
}
onSave(){
.
.
.
(success)=>{
this.loginModel.close();
}
}
保存功能成功后如何关闭 ng-bootstrap 模式?
这是我目前的情况:
save(form, activeModal) {
this.goalsService.createNewGoal(this.team_id, form.value, this.date_created, this.date_modified)
.subscribe(
() => {
form.reset();
activeModal.dismiss('Successfully created Goal');
},
err => alert(`error creating goal ${err}`)
);
}
原来这是一个非常简单的修复。我需要做的就是将 activeModal.dismiss('Successfully created Goal');
更改为 this.activeModal.dismiss('Successfully created Goal');
使用NgbModal
服务打开模态时,会returnNgbModalRef
实例。
使用 returned 实例我们可以关闭或关闭模态。
loginModel : NgbModalRef;
constructor(private modalService:NgbModal) {}
onOpen(){
this.loginModel = this.modalService.open(content);
}
onSave(){
.
.
.
(success)=>{
this.loginModel.close();
}
}