RouterLink not working in grid in angular 2

送分小仙女□ 提交于 2019-12-25 08:59:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!