angular2-polyfill
angular2-polyfill copied to clipboard
Add possibility to inject parent components
An example of this is the TabsComponent where the child component gets a reference to the parent component. I don't directly have an idea on how to do this except that it should pass in the $ctrl property of the parent component.
This is how it can be achieved at the moment
@Component
class TabsComponent {
doSomething() {
}
}
@Component
class TabComponent {
private tabsComponent: TabsComponent;
constructor(@Inject('$scope') scope) {
this.tabsComponent = scope.$parent.$ctrl;
}
ngOnInit() {
this.tabsComponent.doSomething(this);
}
}