Skip to content

Update to Angular 20

Latest
Compare
Choose a tag to compare
@daemons88 daemons88 released this 02 Jun 06:43
· 1 commit to main since this release

In addition to updating the library version to Angular 20, two new validators were added:

  • minFileCount and maxFileCount. With these validators, you can now limit the number of files that can be uploaded for the multiple upload input.

Here is the example:

In the .ts file we added the new validators:

this.demoForm = this.formBuilder.group({
.....
multiplefile: [
 '',
  [
    FileValidator.minFileCount(this.minFiles),
    FileValidator.maxFileCount(this.maxFiles)
   ]
  ]
})

And in the HTML we just added this:

@if (multiplefile?.hasError('minFileCount')) {
  <mat-error>
    You need at least {{minFiles}} uploaded file
  </mat-error>
}
@if (multiplefile?.hasError('maxFileCount')) {
  <mat-error>
    You can have max {{maxFiles}} uploaded file
  </mat-error>
}

You can check all the example code here.