Decorator that wraps a class in a DI injector for the given dependencies.
Dependencies are assigned to the prototype, and can be referenced from within the Class as this.$name
.
import inject from 'ng-inject';
// decorator takes a list of angular dependency names:
@inject('$scope', 'config')
class ExampleController {
constructor() {
// both `$scope` and `config` are injected via DI:
this.$scope.config = this.config;
}
otherMethod() {
this.$scope.value = 1;
}
}
BSD 3-Clause