Возможно, но это настоящая боль в а **.Я сделал один с Java Spring в прошлом месяце.Как правило, вам нужно загрузить каждый элемент после проверки вручную, существует ли этот элемент
app.module.ts
import { NgModule, Inject } from '@angular/core';
import { BrowserModule, DOCUMENT } from '@angular/platform-browser';
// Add all components to this array
const components: any[] = [
//normal components goes here
LoginFormComponent
];
// Bootstrap components
const mainComponents: any[] = [
AngularComponent
];
@NgModule({
imports: [
BrowserModule,
HttpClientModule,
.
.
.
],
providers: [...],
declarations: components,
entryComponents: mainComponents
})
export class AppModule {
private browser_document: any;
// this bootstraps each main component
ngDoBootstrap(app: any) {
for(let component of mainComponents) {
if (this.browser_document.getElementsByTagName(component.selector).length > 0) app.bootstrap(component);
}
}
constructor(@Inject(DOCUMENT) private document: any) {
this.browser_document = document;
}
}
angular.component.ts
import { Component } from "@angular/core";
@Component({
selector: 'angular-component',
templateUrl: './valuation.requests.view.component.html'
})
export class AngularComponent {
static selector: String = 'angular-component'; // this is important
}
что-то.html
<angular-component></angular-component>
По сути, вам нужно перезагрузить каждый подкомпонент после проверки, существует ли он на DOM
PS: основные компоненты должны добавить массивы components
и mainComponents