i have a datatable showing a list of users, i want to be able to click on.
problems i can't use routerLinks inside this datatable but dont want the whole site reloading with a normal HREF.
So depending on what customer i'm clicking i want to be able to send the user to that customer.
This is working for customer 1 but how will i make this dynamic and able to get the ID of the link.
this.datatable = (<any>$('#m_datatablegg')).mDatatable(options);
let _self = this;
this.datatable.on('m-datatable--on-layout-updated', function(e) {
$(_self.elRef.nativeElement).find('.btn.whatsiteilike ').click(function(e){
e.preventDefault();
_self.router.navigate(['livedata/customers/1']);
});
});
This is where i'm creating the actual button/link
<a href="livedata/customers/'+t.id+'"
class="m-portlet__nav-link btn whatsiteilike m-btn m-btn--hover-accent m btn--icon m-btn--icon-only m-btn--
pill" title="Edit details">
<i class="la la-edit"></i>
</a>
This is the reason i got from those making the datatable
Datatable element is rendered after Angular has finished compiling, render in the browser.
Angular processes the template when the component is compiled. HTML added later via ajax or append is not compiled anymore and RouterLinks bindings are ignored.
You need to add RouterLink programmatically in the component.