ng-inject

1.0.1 • Public • Published

ng-inject

NPM travis-ci

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.


Usage

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;
    }
 
}

License

BSD 3-Clause

Package Sidebar

Install

npm i ng-inject

Weekly Downloads

9

Version

1.0.1

License

BSD

Unpacked Size

10.7 kB

Total Files

7

Last publish

Collaborators

  • billneff79
  • developit
  • pl12133