selecting all check boxes inside ng-grid

Wednesday, July 9, 2014

I found some jsfiddle jquery code and tried to combine it with my ng-grid to select all check boxes within the grid. However, it is not working.

Here is a quickmock up of what i tried to do:

this is my directive

var app = angular.module('provider-selectall', []);
restrict: 'A',
link: function(scope,element,attr){ {
$('.ngSelectionCheckbox input[type="checkbox"]').prop('checked', true);

the button that will activated by the directive

<div class="btn-group">
<button class="my-btn btn-info" select-all>Select All</button>

stuff within my ng-grid controller

var checkBoxCellTemplate = '<div class="ngSelectionCell"><input tabindex="-1" class="ngSelectionCheckbox" type="checkbox" ng-checked="row.selected" /></div>';
$scope.gridOptions = {
columnDefs: [
cellTemplate: checkBoxCellTemplate,
showSelectionCheckbox: true
field: 'name',
displayName: 'CPT Code/Description'
field: 'cash_price',
displayName: 'Cash Price'
field: 'average_price',
displayName: 'Average Price'

data: 'provider_medical_services'

original jsfiddle code:

$('#toggle-all').click(function() {
$('.btn-group input[type="checkbox"]').prop('checked', true);