I built a custom datepicker that supports angular material + should work well with angular reactive forms.
(you can install it from npm also: npm install @covercy/datepicker
)
The code is on github:
The component has some internal validators (for example, it validates for invalid date), which are set in the OnInit method.
The issue is that if I change the validators on the input element from outside (when using the component), for example: setValidators(Validators.required), it removes the internal validators.
Where is the correct place to set the intarnal validators? I thought that i should set them each time someone sets the validators from outside, but i didn't find an event that i can listen to for that..
providers: [{ provide: NG_VALIDATORS, useExisting: YourComponent, multi: true}]
, but then you need Inject the NgControl outside the constructor ] – Eliseo