Relative Content

Tag Archive for angularangular-reactive-forms

Angular Reactive Forms Label Clipping

I’m posting this so I can solve it because it was a big problem for me until just now. Angular reactive forms with <mat-form-field> will clip half the label inside a flex-box without doing anything to it.

Angular reactive form hasValidator return false for custom validator function

import { AbstractControl, ValidationErrors, ValidatorFn } from ‘@angular/forms’; export function trimValidator(minlength: number, maxlength: number): ValidatorFn { return ({ value }: AbstractControl): ValidationErrors | null => { const trimValue = value?.trim() || ”; if (trimValue.length < minlength) { return { minlength: true }; } else if (trimValue.length > maxlength) { return { minlength: true }; } […]