I'm using a headerCellTemplate in the columDefs of my ui-grid (not ng-grid but the new rewrite). In the html I have a checkbox. Essentially I am trying to add a checkbox in the header of a column that is all checkboxes so I can check all/none. The cell renders fine with the checkbox. The problem is that the ng-change in the checkbox in the header never fires the event. Additionally the ng-model value never changes. Looking at the code there is a directive used called uiGridHeaderCell so I have to assume that it is gobbling up my event as well as being in its own scope so it never sets the variable in my scope.
Any way around this? Every example I've come across never has anyone trying to call their own method from within the header (ie calling something outside the scope of the directive).
External-Scopes is no longer used as of ~3.0.7 Accessing Scope in templates
Now you add grid.appScope like this in your cellTemplate:
ng-click="grid.appScope.myFunction()"
When using Angular's controllerAs
syntax...
ng-click="grid.appScope.vm.editRow(grid, row)"
example: http://plnkr.co/edit/D48xcomnXdClccMnl5Jj?p=preview
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With