Angular 反应式表单验证

Angular Reactive form validation

我正在使用 Reactive 表单,我注意到在一些教程中它们会执行以下操作:

HTML

.
.
<input type="text" formControlName="firstName" required>
.
.

TS

.
.
firstName: ['', Validators.required]
.
.

问题:

为什么我需要在HTML[=中指定"required" 30=] 如果我只是在 TS 文件中做它工作正常吗?

实际上,Angular 提一下 here:

Caution: Use these HTML5 validation attributes in combination with the built-in validators provided by Angular's reactive forms. Using these in combination prevents errors when the expression is changed after the template has been checked.