Controlling visibility
You can be more specific where you want to get dependencies from. For instance, you can ask for another directive on the same element.
class CustomInputComponent {
constructor(@Self() f: FormatterDirective) {}
}
Or you can ask for a directive in the same template, that is, you can only inject an ancestor directive from the same HTML file.
class CustomInputComponent {
constructor(@Host() f: CustomForm) {}
}
Finally, you can ask to skip the current element, which can be handy for decorating existing providers or building up tree-like structures.
class SomeComponent {
constructor(@SKipSelf() ancestor: SomeComponent) {}
}