I am working on an application built using angular2 with typescript. I am using ag-grid to display data in grid but not able to find the grid api.
///
In your ts file there is a gridOptions variable declared in class level.
var gridOptions;
But you are not assigning any value for it. So it's undefined.
Inside the constructor you are assigning a value for a gridOptions variable which is local to that method.
However the gridOptions you have bind with grid is the class level variable which is undefined. So you are getting an error. So modify the code like follows.
constructor(private _heroService: HeroService) {
....
this.gridOptions = {
enableSorting: true,
rowData: this.rowData,
....