Created
February 25, 2014 19:00
-
-
Save sergioceron/9215314 to your computer and use it in GitHub Desktop.
Use jQuery Datatables API with AngularJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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