简体   繁体   中英

RouterLink not working in grid in angular 2

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM