问题
Recently i started using jqwidgets (here) for my Angular project, it worked well but the only problem is I put edit at each cell.To that edit button routerLink is not working.
My code,
this.columns =
[
{
text: 'Id', columntype: 'textbox', width: 80
},
{
text: 'Name', columntype: 'textbox',datafield: 'name', width: 130
},
{
text: 'Group Name', columntype: 'textbox', datafield: 'group_id', width: 130
},
{
text: 'Actions',datafield: 'id', cellsrenderer: Action, width: 100
}
];
This is my action function,
var Action = function (row,datafield,value) {
return '<button ><a routerLink="pages/users">EDIT</a</button>'
}
When i replace routerLink with href its working,can anyone please help me.Thanks.
回答1:
Seems like that this widget will add your html code directly to the DOM. So angular is bypassed and it's not a "valid" angular-object and isn't handled/recognized by angular itself.
It's a problem of that widget, seems like you can't change that behavior.
来源:https://stackoverflow.com/questions/43535010/routerlink-not-working-in-grid-in-angular-2