I\'m doing some tests with Angular 2 and I have a directive (layout-item) that can be applied to all my components.
Inside that directive I want to be able to read s
It seems that most convenient and clean way is to use provider alias:
//ParentComponent declaration
providers: [{ provide: Parent, useExisting: forwardRef(() => ParentComponent) }]
where Parent is separate class that works as OpaqueToken and abstract class at the same type.
//directive
constructor(@Optional() @Host() parent:Parent) {}
Each component that is accessed from child directive should provide itself.
This is described in documentation: link