【问题标题】:RouterLink not working in grid in angular 2RouterLink 在角度 2 的网格中不起作用
【发布时间】:2017-04-21 06:01:23
【问题描述】:

最近我开始在我的 Angular 项目中使用 jqwidgets (here), 它工作得很好,但唯一的问题是我在每个单元格上都进行了编辑。到那个编辑按钮 routerLink 不起作用。

我的代码,

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
    }
];

这是我的动作函数,

 var Action = function (row,datafield,value) {    
    return '<button ><a routerLink="pages/users">EDIT</a</button>'
 }

当我用 href 替换 routerLink 时,任何人都可以帮助我。谢谢。

【问题讨论】:

    标签: angular datagridview angular2-routing


    【解决方案1】:

    似乎这个小部件会将您的 html 代码直接添加到 DOM。所以 angular 被绕过了,它不是一个“有效的” angular-object,并且不被 angular 本身处理/识别。

    这是那个小部件的问题,似乎你无法改变这种行为。

    【讨论】:

    • 您好 mxii,您有什么建议吗?
    猜你喜欢
    • 1970-01-01
    • 2016-12-18
    • 2017-02-23
    • 2019-01-17
    • 2017-04-13
    • 1970-01-01
    • 2016-11-13
    • 2016-05-06
    • 2020-02-16
    相关资源
    最近更新 更多