Closed Rush closed 8 years ago
Usung TypeScript the code can be refactored to
constructor(private $http) {
}
which will automatically put $http
on this
Thanks, good to know but I'd like to know about ES6.
@rush not a bad idea. I think it sounds good.
Any ideas how could it be implemented then? (I am pretty new to decorators and all this ES6/7/TS stuff)
We would add them in directive-controller.js. That's where we instantiate the components controller. We have access to the injects there so we'd just have to get their references from the injector and add them as properties. Just like we do with inputs kind of. On Wed, Nov 18, 2015 at 3:59 PM Damian Kaczmarek notifications@github.com wrote:
Any ideas how could it be implemented then? (I am pretty new to decorators and all this ES6/7/TS stuff)
— Reply to this email directly or view it on GitHub https://github.com/ngUpgraders/ng-forward/issues/87#issuecomment-157861686 .
- Tim
After discussing with @MikeRyan52 we aren't going to add this feature. While it's a good idea, it's not a feature of Angular 2 and we are trying to keep parity with the ng2 feature set since this is essentially a polyfill library. As @pbastowski stated you can get this feature from TypeScript, which is how you'd have to do it in Angular 2 as well. Thanks and sorry!
Thanks for this awesome project, I just started using it and I have a question, right now I have to do:
I don't like the redundancy of injection params though, is there a way to omit writing the below altogether?
This could be set automatically by the decorator.