These are chat archives for ngUpgraders/ng-forward

23rd
Nov 2015
Chris Rowe
@cwmrowe
Nov 23 2015 10:13
@timkindberg According to this article you can get a parent dependancy in Angular 2 by specifying it in the child component's constructor.http://blog.thoughtram.io/angular/2015/04/09/developing-a-tabs-component-in-angular-2.html
Tim Kindberg
@timkindberg
Nov 23 2015 15:07
@brandonroberts have you figured it out?
@cwmrowe oh man you are right. That feature relies heavily on the hierarchical injector. I'm not sure we'll be able to do that in ng-forward... it would theoretically look like this:
@Component()
@Inject(Tabs)
class Tab {
  constructor(tabs) {}
}
In ng-forward components are not injectables (as of now).
Tim Kindberg
@timkindberg
Nov 23 2015 15:12
Problem here is we could add this feature and make component's injectable but then they are singletons, so you could not have more than one 'Tabs' component in your whole app.
We might be able to do something interesting though where we could check to see if an injectable is a component.... if it is, we perform the angular.element().controller() call behind the scenes and add the resulting controller instance as a $local on the requesting components controller
It just might be possible :unamused:
I'll write up an issue
Steven Weingärtner
@eXaminator
Nov 23 2015 15:17
That would be an awesome feature :)
Tim Kindberg
@timkindberg
Nov 23 2015 15:19
Well don't get your hopes up
:)
not sure if its possible
We also have to think about light dom and shadow dom...
ugh
Chris Rowe
@cwmrowe
Nov 23 2015 15:19
cheers @timkindberg
Steven Weingärtner
@eXaminator
Nov 23 2015 15:19
I think it could be problematic as there might be a reason why angular doesn't inject required controllers as locales into other controllers
Tim Kindberg
@timkindberg
Nov 23 2015 15:20
probably right
@eXaminator did you get your local build working?
Chris Rowe
@cwmrowe
Nov 23 2015 15:21
also, it just so happens that in my use case the parent directive uses replace, so I am not sure how you would write an element selector for that...
Steven Weingärtner
@eXaminator
Nov 23 2015 15:21
Not yet, didn't get to it. I'll have a look at it later
Well, you introduce all kinds of problems when using replace
Chris Rowe
@cwmrowe
Nov 23 2015 15:23
true, it's not even strictly necessary in our case, but a banana skin none the less.
Brandon
@brandonroberts
Nov 23 2015 15:29
@timkindberg not yet. I can get it to work locally with Chrome 37. I need to see if adding the experimental flags in travis will fix it in CI
Tim Kindberg
@timkindberg
Nov 23 2015 16:59
@brandonroberts that's a good idea