数据删除与Angular应用中的单击事件绑定,禁用的绑定和验证一起使用时,不会关闭Bootstrap模版

时间:2018-07-30 14:51:11

标签: angular bootstrap-4

我正在使用Bootstrap 4.1在Angular 6中创建一个错误跟踪应用程序。此设置以前曾在所有早期版本中内置的同一应用程序中起作用。但是我正在用最新版本重建它。

<button            
  class="btn btn-success btn-xl"
  type="submit"
  data-dismiss="modal"
  (click)="submitForm()"
  [disabled]="bugForm.invalid">
  Save
</button>

该模式包含一个用于输入新错误的表格。该问题似乎涉及三个部分:单击事件绑定,禁用的绑定和验证。我可以通过以下两种方法来使数据删除工作:1)删除单击事件绑定,2)删除禁用的绑定,或3)注释掉.ts文件中对表单中输入的Bug属性应用的Validators.required(如下)

this.bugForm = this.formB.group({
  title: [this.currentBug.title, 
    [Validators.required, forbiddenStringValidator(/bug/i)]],
  status: [this.currentBug.status, Validators.required],
  severity: [this.currentBug.severity, Validators.required],
  description: [this.currentBug.description, Validators.required]
});

执行这三个动作中的任何一个,而其他两个动作保持原样,可以使数据删除工作正常进行。并保留了所有三个功能,除数据关闭之外的所有功能均起作用:仅当所有字段均有效时,该按钮才启用,单击它会导致将新的错误添加到错误列表中并输入数据库,但是模式不会不要走。

有人知道造成冲突的原因是什么?没有控制台错误。

根据记录,我按照Bootstrap的文档将Bootstrap类替换为“ close”,但这没有帮助。在Bootstrap类中使用“ close”会杀死样式。

0 个答案:

没有答案