问题
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