Disabling deep watchers

The angular-datatables uses deep search for changes on every $digest cycle. Meaning every time any Angular event happens (ng-clicks, etc.), the entire array, each of it's children, it's children's children, and so forth gets compared to a cached copy.

There is an attribute to add so that if the directive has a truthy value for dt-disable-deep-watchers at compile time then it will use $watchCollection(...) instead. This would allow users to prevent big datasets from thrashing Angular's $digest cycle at their own discretion

angular.module('datatablesSampleApp', ['datatables']).controller('DisableDeepWatchers', DisableDeepWatchers); function DisableDeepWatchers(DTOptionsBuilder, DTColumnBuilder) { var vm = this; vm.dtOptions = DTOptionsBuilder.fromSource('data.json') .withPaginationType('full_numbers'); vm.dtColumns = [ DTColumnBuilder.newColumn('id').withTitle('ID'), DTColumnBuilder.newColumn('firstName').withTitle('First name'), DTColumnBuilder.newColumn('lastName').withTitle('Last name').notVisible() ]; }

data.json 

[{ "id": 860, "firstName": "Superman", "lastName": "Yoda" }, { "id": 870, "firstName": "Foo", "lastName": "Whateveryournameis" }, { "id": 590, "firstName": "Toto", "lastName": "Titi" }, { "id": 803, "firstName": "Luke", "lastName": "Kyle" }, ... ]