I have a simple application in angular 2. I want to display data in a paginated table. I found this example very nice and I would like to use in my app.
The
html
of the example is inhome.component.html
,The
css
of the example is in script inindex.html
like:
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/select/1.2.2/css/select.dataTables.min.css">
I want to know where I should put the java script code for this to work. I have tried to put in index.html
and home.compose.html
, but none on this worked correctly.
Please tell me where the java script code should go. Thank. This is the javascript:
$(document).ready(function() {
$('#example').DataTable( {
columnDefs: [ {
orderable: false,
className: 'select-checkbox',
targets: 0
} ],
select: {
style: 'os',
selector: 'td:first-child'
},
order: [[ 1, 'asc' ]]
} );
} );