How does AngularDart dependency injection work?

旧巷老猫 提交于 2019-12-05 20:59:09
Günter Zöchbauer

Classes are registered using the Module.type() method (or factory, value).

You can take a look at Angular.dart source - search for 'type(' like lib/core/module.dart

(Please ignore the results where type is not the function name)

When a constructor or a method called by Angular needs a parameter DI looks up its registered types/values/factories and uses a provided instance (value) or creates a new instance (type) or uses the result that a factory returns and injects it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!