injecta
A simple AngularJs or Angular-style typescript and javascript dependency injection library.
Import
import { injecta } from "injecta"
Usage
; /* Setting tokens*/ injecta .setValue"url", "/getUsers" .setValue"someValues", .setService"userService", UserService .setFactory"controller", ; /* Getting token values*/ ;;; console.logval; // /getUsersconsole.logdata; // [1, 2, 3]console.logctrl; // Controller {service: {…}, data: Array[3]} <-- controller instance with resolved dependenciesconsole.logctrl.double; // [2, 4, 6]
Install Choices
npm install injecta
- download the zip
- clone the repo
License
(The MIT License)