0

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?

3
  • You can delay the creation of the grid, using contructs like ng-if and only when the data is available render the grid. Commented Oct 10, 2013 at 13:47
  • 1
    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 ? Commented Oct 10, 2013 at 15:33
  • 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? Commented Oct 13, 2013 at 6:29

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.