{"repo":"mgechev/injection-js","free":true,"listed":false,"github":"https://github.com/mgechev/injection-js","clone":"git clone https://github.com/mgechev/injection-js.git","description":"Dependency injection library for JavaScript and TypeScript in 5.1K. It is an extraction of the Angular's ReflectiveInjector which means that it's well designed, feature complete, fast, reliable and well tested.","language":"TypeScript","stars":1378,"topics":["javascript","typescript","dependency-injection","node","decorators"],"license":null,"category":"dev-tools","readme_excerpt":"Dependency Injection Dependency injection library for JavaScript and TypeScript in 5.2K . It is an extraction of the Angular's dependency injection which means that it's feature complete, fast, reliable and well tested. Why not Angular version 5 and above? Angular version 5 deprecated the ReflectiveInjector API and introduced StaticInjector . In short, the dependency injection in the newest versions of Angular will happen entirely compile-time so reflection will not be necessary. However, if you want to use dependency injection in your Node.js, Vue, React, Vanilla JS, TypeScript, etc. application you won't be able to take advantage of StaticInjector the way that Angular will because your application won't be compatible with Angular compiler. This means that if you need dependency injection outside of Angular @angular/core is not an option. In such case, use injection-js for fast, small, reliable, high-quality, well designed and well tested solution. How to use? Note: For ES5 Class syntax and TypeScript you need a polyfill for the Reflect API. You can use: - reflection (only 3kb 🔥) - reflect-metadata - core-js ( core-js/es7/reflect ) Also for TypeScript you will need to enable experimentalDecorators and emitDecoratorMetadata flags within your tsconfig.json TypeScript Using the latest inject function: Using @Injectable and reflect-metadata : ES6 ES5 API For full documentation check Angular DI docs: - Dependency Injection - Dependency Injection in action - Dependency Injection ","default_branch":null,"files":null,"tree":[],"storefront":"/r/mgechev","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/mgechev/injection-js/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}