Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to inject parent components #34

Open
SamVerschueren opened this issue Mar 15, 2016 · 0 comments
Open

Add possibility to inject parent components #34

SamVerschueren opened this issue Mar 15, 2016 · 0 comments

Comments

@SamVerschueren
Copy link
Owner

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);
     }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant