I used jQuery dataTable for display data on list view. And I tried to bind data to dataTable using following way.
On users.component.ts
getUsers() {
this.UserService.getUsersList()
.subscribe(
success => {
this.userList = success;
$("#userTable").find('tbody').empty();
var dataClaims = this.userList;
for (let i = 0; i < dataClaims.length; i++) {
$('#userTable').dataTable().fnAddData([
(i + 1),
dataClaims[i].name,
dataClaims[i].email,
dataClaims[i].contact_number,
dataClaims[i].address,
'<a [routerLink]="[' +"'"+"../../user/update" +"'" +']"' + ' class="fa fa-1x fa-pencil-square-o"></a>',
]);
}
}
);
}
Above function is working properly and dataTable is working without issue.
But [routerLink] is not converted to html. On the output it is displayed following way,
<a [routerlink]="['../../user/update']" class="fa fa-1x fa-pencil-square-o"></a>
But it should be converted to following way,
<a _ngcontent-c0="" ng-reflect-router-link="user/update" href="/user/update" class="fa fa-1x fa-pencil-square-o"></a>
Could someone please explain how to convert [routerlink] to normal link when render html data from a .ts file. Thank you.