Я создал родительский компонент и вызвал дочерний компонент с помощью ng-контейнера и передал значение дочернему компоненту ngComponentOutlet = "; injector: getInjector (value);"
Поскольку один из моих дочерних компонентов имеет На вкладке «Мат» в нем зацикливается функция getInjector, и страница не загружается
export class MainLayoutComponent implements OnInit {
modules: any = [
{
module: PrimaryModule,
component: PrimaryLandingPageComponent,
id: 1
},
{
module: SecondaryModule,
component: SecondaryLandingPageComponent,
id: 2
},
];
constructor(public compiler: Compiler) { }
returnCompiledModule(moduleItem) {
return this.compiler.compileModuleSync(moduleItem);
}
ngOnInit() {
console.log('hello');
}
getInjector(Item) {
return Injector.create([{ provide: Number, useValue: Item}], this.injector);
}
}
И я отрисовываю в HTML как
<ng-container *ngComponentOutlet="module.component;
injector: getInjector(module);
ngModuleFactory: returnCompiledModule(module.module); ">
</ng-container>
Но у меня httpsgetrequest в PrimaryLandingPageComponent. Таким образом, возвратный инжектор вызывает в al oop.
Это происходит, когда у меня тоже есть вкладка mat в PrimaryLandingPageComponent