I'm using a template that I bought in Angular, but it's not all in Angular has a lot of jQuery.
I'm using jQuery's Datatable (since it's already the template's native, it's all css ready and it's already fetching the data and paging), but I need some actions on some elements that I need (I want) that is processed by the angular. How to bookmark a checkbox for example.
I'm using the fnRowCallback from Datatable to handle the html. In the example below I would like to change the checkbox state (html generated by the jQuery plugin) the data is sent to the changePropertyEnabled method (Angular component method)
...,
fnRowCallback: function (nRow, aData, iDisplayIndex) {
const mDataEnabled = '<label class="ui-switch switch-icon">' +
'<input type="checkbox" (change)="changePropertyEnabled(1, false)">' +
'<span></span>' +
'</label>';
const mDataRemoveIcon = '<a class="text-muted font-16" href="javascript:;"><i class="ti-trash"></i></a>';
//
$('td:eq(0)', nRow).html(mDataEnabled);
$('td:eq(6)', nRow).html(mDataRemoveIcon);
return nRow;
},
...
changePropertyEnabled(id: number, enabled: boolean) {
alert('Hello World');
}