【发布时间】:2021-10-06 13:40:18
【问题描述】:
当我点击保存时,我希望我的表单被验证然后弹出应该打开。?但是现在当我点击保存弹出窗口正在打开,关闭弹出窗口后,它显示验证。我试过了,还是不行
<button class="btn btn-primary py-2 px-3 mt-3" type="submit" data-toggle="modal" data-target="#saveCerts">Save</button>
模态:
<div class="modal fade modal-mini modal-primary" id="saveCerts" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-small">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title pull-left text-white">Alert</h4>
<button mat-button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="material-icons">clear</i></button>
</div>
<div class="modal-body">
<p>Make sure you are providing your finalized label name. You cannot change it in future once you start using it in your projects. </p>
</div>
<div class="modal-footer justify-content-center">
<button mat-raised-button type="button" data-dismiss="modal" class="btn btn-primary px-3 -y-2" (click)="uploadCerts()">OK
</button>
</div>
</div>
</div>
</div>
ts:
uploadCerts(){
if (this.labelvalue == null || this.labelvalue == '') {
this.nolabel = true;
return;
}
let format = /[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/;
if(format.test(this.labelvalue)){
this.noSpecialChar = true;
return;
}
const ind = this.sslfileDetails.filter((x => x.label == this.labelvalue))
if(ind.length > 0){
this.sharedService.errorAlert("Label already taken")
return
}
if(this.rootdata == undefined && this.certdata == undefined){
if(this.combidata == undefined){
this.sharedService.errorAlert("Please upload either .crt and .key certificates or Combined certificate")
return;
}
}else if(this.rootdata != undefined){
if(this.certdata == undefined){
this.sharedService.errorAlert("Please upload either .crt and .key certificates or Combined certificate")
return;
}
}else if(this.certdata != undefined){
if(this.rootdata == undefined){
this.sharedService.errorAlert("Please upload either .crt and .key certificates or Combined certificate")
return;
}
}
【问题讨论】:
-
也许您应该使用
-
好的,谢谢你的回复,我会试试这个,让你。
-
您的保存按钮
data-toggle="modal" data-target="#saveCerts"具有打开模型的属性。您应该使用代码打开模型 -
谢谢navnath的回复,我试试
-
检查这可能有助于验证后打开模型stackoverflow.com/questions/35400811/…
标签: angular validation popup