]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/forms/form-reactive.ts
Client: use ng2-tag-input for forms with video tags
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / forms / form-reactive.ts
index 1e8a69771c5ffe37d563a665cb8fa026e6c38185..a5732e083a647422335ae176a797477e7257acbb 100644 (file)
@@ -21,4 +21,20 @@ export abstract class FormReactive {
       }
     }
   }
+
+  // Same as onValueChanged but force checking even if the field is not dirty
+  protected forceCheck() {
+    for (const field in this.formErrors) {
+      // clear previous error message (if any)
+      this.formErrors[field] = '';
+      const control = this.form.get(field);
+
+      if (control && !control.valid) {
+        const messages = this.validationMessages[field];
+        for (const key in control.errors) {
+          this.formErrors[field] += messages[key] + ' ';
+        }
+      }
+    }
+  }
 }