At present my solution is through the import to dynamically generated, there are other ways to not through the import?
abc.ts
export class abc{
constructor(){
alert('hello world');
}
}
export class abc2{
constructor(){
alert('hello world2');
}
}
app.component.ts
...
import * as myModule from './abc';
@Component({
...
})
export class AppComponent {
createAllClass(){
let allClassName = ['abc','abc2'];
allClassName.forEach(className => {
new myModule[className]();
});
}
}