Skip to content

A JS decorator for injecting dependencies inside your classes.

Notifications You must be signed in to change notification settings

cmartin81/angular-inject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

angular-inject

A angular decorator for angular dependency injection.

Install

$ npm install --save angular-inject 

Usage

// ES2016 style
import {inject} from 'angular-inject'

// CommonJS style
let inject = require('angular-inject').inject;


@inject( ['$base64', 'foobar'] )
class FooBarController {
    constructor(){  /if needed you can also access the injected variables here also (ie constructor(base64, foobar) )  
        ....
        ....
        ....
    }
    
    bar() {
        this.$base64.encode('babba');
    }
}

Note

You need to run babel with the option 'es7.decorators' enabled.

About

A JS decorator for injecting dependencies inside your classes.

Resources

Stars

Watchers

Forks

Packages

No packages published