我正在使用Angular2并一起做出反应。为此,我有以下TSX文件....
export class ReactDataGridComponent implements AfterViewInit {
@ViewChild('target', {read: ViewContainerRef}) target: ViewContainerRef;
constructor(
private el:ElementRef,
@Inject("Window") private window: Window,
private lib: LibraryService,
private cd: ChangeDetectorRef
) {}
rowGetter(i) {
return this.lib.data.datasets[i];
}
render(){
ReactDOM.render(
<ReactDataGrid
minHeight={this.el.nativeElement.offsetHeight}
columns={this.lib.data.headers}
rowGetter={this.rowGetter.bind(this)}
rowsCount={this.lib.data.datasets.length}
/>,
this.el.nativeElement.innerHTML
);
}
ngAfterViewInit(){
this.window.onresize = this.render.bind(this);
this.lib.resetSubject.subscribe(()=>{
this.render();
})
this.lib.getLibrarySummaryItems();
}
}
这可行但是如果React渲染说Angular Material Components ....
<div fxFlex> <md-icon>home</md-icon> </div>
Angular不处理指令和组件。有一种方法,一旦发生这种变化,我可以告诉角度重新连接组件吗?