I am connecting a datatable from datatables.net with my Angular app where I am trying to get data fra a row in typescript. I can see the data through the console, but I can't reach my other methods in the class.
So i tried to .bind(this) on the table.on() method but did not help.
var table = $('#datatable').DataTable();
// Edit record
table.on('click', '.edit', function() {
let $tr = $(this).closest('tr');
var data = table.row($tr).data();
console.log(data[0]);
this.navigateTo(data[0]);
}.bind(this));
But i receive following error:
ERROR TypeError: Cannot read property '0' of undefined
So I need a symbol from data from data[0] to pass on to another component. But then this error shows.
What am I doing wrong? I guess it is something with the .bind(this), but i am not sure.
Thanks in advance.