user17456983
user17456983

Reputation: 11

How to set validation in wrapper of input in Angular?

I want to create custom component for input text but I don't know how can I bind validation of each input field to custom component. Is there any way to set errors of each field as array of objects like below

  [errors]="[
        { type: 'required', message: 'REQUIRED'},
        { type: 'minlength', message: 'MINLENGTH=3' }
      ]"

https://stackblitz.comhttps://stackblitz.com/edit/angular-13-custom-input-controlvalueaccessor-qzezsm?file=src%2Fapp%2Fcustom-input%2Fcustom-input.component.html,src%2Fapp%2Fapp.component.html,src%2Fapp%2Fapp.component.ts,src%2Fapp%2Fcustom-input%2Fcustom-input.component.ts

Upvotes: 1

Views: 60

Answers (0)

Related Questions