This is my first Angular2 project and I use ng2-handsontable for grid. And I have problem with ng2.handsontable. Links and buttons are not working for me.
Grid settings:
userItems: UserItem[]=[];
private colHeaders: Array<string> = ['View'];
private columns: Array<any> = [
{
data: 'viewDetails',
renderer: 'html',
readOnly: true
}
];
//After getting users populated, results are mapped
mapUsers(users: UserItem[]): void {
this.userItems = users;
for (var userItem of this.userItems) {
userItem.viewDetails= '<a href='/admin/users/1'>Details</a>';
}
}
Problem with link:
If I put href='/admin/users/1' in tag, correct page will open. But whole angular application is loaded again.
userItem.viewDetails= '<a href='/admin/users/1'>Details</a>';
Because of that I want to use routerlink.
When I create link like this routerlink='/admin/users/1' link is not called.
userItem.viewDetails = '<a routerlink='/admin/users/1'> Details</a>';
Adding href=’#’ to this version, also does not help.
I also try: href="javascript:return auctions('1')" where auction is call to angular2 method, but that does not work.
userItem.viewDetails= '<a href="javascript:return details('1')">Details</a>';
Problem with buttons in this grid is that on click angular action is not called.
userItem.viewDetails= '<button (click)="details(1)">Details</button>';
Looking forward to suggestions :)