0
votes

I'm new to Angular, and I'm trying to declare gridOption for ng-grid within a function, because I don't want it to fire before the data comes from the server. But if I do so, it cause an error:

TypeError: Cannot set property 'gridDim' of undefined

What is going on?

1
You can delay the creation of the grid, using contructs like ng-if and only when the data is available render the grid. - Chandermani
any specific reason you don't want to fire gridOptions ? You know you can also opt to hide the grid and display it only after data comes in ? - AardVark71
The problem is not that the grid not load immediately but the data not load at all because the error. @Chandermani - can you give me example? - offset

1 Answers

4
votes

To stop rendering till the data arrives do something like

<div ng-if="contentAvailable">
   <ng-grid/>
</div>

In you controller when the data is available setup the gridoptions object, followed by contentAvailable to true.