版权声明:本文为博主原创文章,转载请注明出处。 https://blog.csdn.net/mayfla/article/details/78942562
传统依赖控制,由使用者自己new
依赖注入
控制器从内部转到了外部
注入器
把service注入到product1中,在app模板中使用product1
service
Module
Product1
Product1.html
App.html
Product2
效果
在service间进行注入
步骤:写组件-在module提供-其他组件注入-调用
注入器的层级关系