Skip to content
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.

Assign constructor's DI parameters as class fields automatically. For Angular 1.x + ES6 classes.

License

Notifications You must be signed in to change notification settings

jonshaffer/angular-inject-on

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Angular injectOn

Assigns DI parameters as class fields automatically. For Angular 1.x + ES6 classes.

Installation

npm install angular-inject-on

Using in a project

First, include the file:

ES5 (Browserify)
require('angular-inject-on');

ES6 (Module imports)
import 'angular-inject-on';

Next, add as your application's dependency:

module.angular('yourApp', [
  ...
  'ngInjectOn'
]);

Lastly, the actual usage:

class MyService {
  constructor($state, injectOn) {
    injectOn(this);
    console.log(this.$state); // $state is now available as class property
  }
}

About

Assign constructor's DI parameters as class fields automatically. For Angular 1.x + ES6 classes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%