Skip to content

Decorator that wraps a class in an Angular 1.x DI injector for the given dependencies.

License

Notifications You must be signed in to change notification settings

synacor/ng-inject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Decorator that wraps a class in an Angular 1.x DI injector for the given dependencies.

Resources

License

Stars

Watchers

Forks

Packages

No packages published