Yes, you need to add systemjs to your angular-cli and use it to load a module. Then you can use componentFactoryResolver
to resolve the components you need in the module. To add systemjs
to your project install it:
npm i systemjs
and the following into angular-cli.json
:
"scripts": [
"../node_modules/systemjs/dist/system.src.js"
],
Also add a link to scripts.js in the page :
This will load systemjs and it will available as a global object. You can then use it like this:
declare var SystemJS;
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
constructor() {
SystemJS.load(...);
}
For details how to use SystemJS to load a module see How to load dynamic external components into Angular application answer
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…