Skip to content

Instantly share code, notes, and snippets.

@sergioceron
Created February 25, 2014 19:00
Show Gist options
  • Save sergioceron/9215314 to your computer and use it in GitHub Desktop.
Save sergioceron/9215314 to your computer and use it in GitHub Desktop.
Use jQuery Datatables API with AngularJS
$scope.$watchCollection( 'myCollection', function( oldCollection, newCollection ) {
if( oldCollection === newCollection ) return;
// Gives the time to destroy dataTable, which is immediately
$( '#dataTable' ).dataTable().fnDestroy();
$timeout(function () {
// After a few time, create the dataTable when DOM render is complete
$( '#dataTable' ).dataTable();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment