Angular 4 remove required validator conditionally

Source: https://stackoverflow.com/questions/46488078/angular-4-remove-required-validator-conditionally

if you want to add validation try this one.
saveDraft() {
   this.form.get('title').setValidators([Validators.required, Validators.minLength(3)]);
   this.form.get('title').updateValueAndValidity();
}
if you want to remove validators try this one.
saveDraft() {
 this.form.get('title').clearValidators();
 this.form.get('title').updateValueAndValidity();
}

Không có nhận xét nào:

filebrowserBrowseUrl and external file browser/uploader

 https://ckeditor.com/old/forums/CKEditor-3.x/filebrowserBrowseUrl-and-external-file-browseruploader Thanks for your replies, it actually wo...