I have set the injector service in AppModule and that mean I will inject Injector and set it in the constractor of AppModule and store the injector service in global object export class AppModule { constructor(injector:Injector){ // Store module's injector in the AppInjector class console.log('Expected #1: storing app injector'); AppInjector.setInjector(injector); }} 演示 这篇关于使用全局注入器的Angular 7组件继承的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-24 22:01