所谓的依赖注入,核心就是依赖。那么在nest中依赖可以是以下这些:
- 一个类的实例
- 一个js对象
- 一个通过useFactory函数返回的值(这个值例如是一个js对象)
- useFactory函数有参数,通过inject字段可以往当前useFactory函数的参数中注入其他Provider,这样子,函数体中就可以使用其他Provider
- useFactory还支持异步
- 还可以使用
useExisting
来对provide的值(其实就是Provider的token)进行别名
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.