在Angular 4中动态创建一个组件,你可以使用ngComponentOutlet指令:https://angular.io/docs/ts/latest/api/common/index/NgComponentOutlet-directive.html
这样的事情:
动态组件
@Component({
  selector: 'dynamic-component',
  template: `
     Dynamic component
  `
})
export class DynamicComponent {
  @Input() info: any;
}
应用
@Component({
  selector: 'my-app',
  template: `
     App<br>
     <ng-container *ngComponentOutlet="component"></ng-container>
  `
})
export class AppComponent {
  this.component=DynamicComponent;
}
如何传递@Input() info: any;此模板中的信息<ng-container *ngComponentOutlet="component"></ng-container>?