I have a few custom directives which are basically designed for .
And I have a custom component
There
You can make every directive provide itself like it is done with ControlValueAccessor
or validators
export const MY_DIRECTIVES = new InjectionToken('MyDirectives');
export const MY_DIRECTIVE1: Provider = {
provide: MY_DIRECTIVES,
useExisting: forwardRef(() => MyDirective1),
multi: true
};
@Directive({
selector: '....',
providers: [MY_DIRECTIVE1]
})
class MyDirective1 {}
and then in your input component
constructor(@Optional() @Self() @Inject(MY_DIRECTIVES) private myDirectives: any[]) {
console.log(myDirectives);
}