Angular ng-grid declare gridOptions in function

谁都会走 提交于 2019-12-02 18:11:31

问题


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:


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.



来源:https://stackoverflow.com/questions/19296500/angular-ng-grid-declare-gridoptions-in-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!