Solution 1 :

You can refer to this stackblitz URL for your above issue I’ve given a details answer.


export class AppComponent implements OnInit {
    name = 'Angular ' + VERSION.major;

    formDummy: FormGroup ={
     val: [
     Validators.compose([Validators.required, Validators.minLength(4)]),

  constructor(private fb: FormBuilder) {}
  ngOnInit(): void {
      console.log('ActualLength ',
      console.log('requiredLength ',

HTML Code for show errors

 <hello name="{{ name }}"></hello>
  <p>Start editing to see some magic happen :)</p>

<form [formGroup]="formDummy">
  <input type="text" formControlName="val" placeholder="Enter number here" />
  <br />

  Value => {{ formDummy.get('val')?.value }}
  <br />
  RequireLength {{ formDummy.get('val')?.errors.minlength.requiredLength }}
  <br />
  ActualLength {{ formDummy.get('val')?.errors.minlength.actualLength }}

Solution 2 :

Disclamer: I’m not prety sure if this can help you

As you can get the “validator” and a validator is a function, you can “check” agains an “on-fly” formControl

const error=this.form.get('value').validator(
    new FormControl('1')
if (error && error.minlength)

Problem :

this.form ={
  value: ['', [Validators.required, Validators.minLength(4)]]

I want to get the 4 from Validators.minLength(4).

How can I get this?


Comment posted by…

where in your code do want to get that value? If it’s in the html to display a message you can look at this question

Comment posted by erzen

No, I want to get this value before the validation error. @Juan

Comment posted by adiga

Why do you need this?

Comment posted by erzen

@adiga to not populate the array if validation is in limit.

Comment posted by caTS

Why not use a constant instead of directly passing 4?