In ag-grid, what does the option angularCompileRows do?

大城市里の小女人 提交于 2020-05-29 09:46:06

问题


I was trying to get individual cells in an ag-grid to fire ng-click events against a scope method in a parent controller today and tried a ton of different things. After looking at some working code people had posted, I noticed that everyone was setting angularCompileRows to true in the gridOptions. I tried turning angularCompileRows on in my own code and it worked! ng-click fired and called the controller method.

My question is: what exactly does angularCompileRows in ag-grid do? I can only find one reference to it in the official documentation (in the code examples on this page) and it's very light on explanation. I'm wondering if there are any side effects/downsides to turning this option on.


回答1:


After googling a bit, I found this in the documentation.

From what I understand, by default ag-grid is built using raw JavaScript for performance purposes. However, if you are willing to take the performance hit, you can set angularCompileRows to true and it will create a new scope per row and you will be able to leverage AngularJS inside Cell Renderers. I think this is why the AngularJS ng- events don't work unless you set angularCompileRows to true



来源:https://stackoverflow.com/questions/38247673/in-ag-grid-what-does-the-option-angularcompilerows-do

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