ngUpgraders / ng-forward

The default solution for those that want to write Angular 2.x style code in Angular 1.x
411 stars 36 forks source link

Support TypeScript-style Parameter Decorators for DI #102

Open MikeRyanDev opened 9 years ago

MikeRyanDev commented 9 years ago

Support this type of injection:

import {Inject, Injectable} from 'ng-forward';
import MyService from './my-service';

@Injectable()
class AnotherService{
  constructor(
     @Inject('$http') private $http: angular.IHttp,
     private myService: MyService
  ){ }
}

This would add behavior to the @Inject decorator to support parameters in the constructor. It would not break existing @Inject functionality. We would also need to change the Module class to support reading design:type metadata when looking for $inject metadata on a provider.

shripalsoni04 commented 8 years ago

+1 for this very useful feature