これは角度の質問が多いかもしれませんが、データを読み込んだ後で明示的なデータグリッドのサイズを変更しようとしていますが(列を動的に表示/隠しています)、エラーは継続します明瞭度のデータグリッドへの参照をtypescriptから取得する方法
Uncaught TypeError: Cannot read property 'resize' of undefined
component.html
<clr-datagrid #contactsGrid>
[...]
</clr-datagrid>
component.ts
import { Component, OnInit, ViewChild } from '@angular/core';
import { Datagrid } from "clarity-angular";
export class GridComponent implements OnInit {
@ViewChild('contactsGrid') datagrid: Datagrid;
//@ViewChild('Datagrid') datagrid: Datagrid; //This doesn't work either
constructor() { }
ngOnInit() {
[...]
this.datagrid.resize(); //this.datagrid is undefined
}
}
データグリッドに* ngIfがありましたが、これは問題のようです。ありがとう。 – Jake