【问题标题】:Expression 'undefined' in attribute 'row' used with directive 'uiGridHeaderCell'与指令“uiGridHeaderCell”一起使用的属性“行”中的表达式“未定义”
【发布时间】:2017-12-04 21:21:05
【问题描述】:

我正在尝试在指令的标题单元格模板中使用单选按钮

headerCellTemplate: '<label><input ng-model="row.entity.selected" type="radio"  value="true"> Option 1 </label>',

我的指令

return {
    restrict: 'E',
    link: linker,
    templateUrl: 'dist/application/a/b/c/test.html',
    scope: {
        data: '=',
        gridTitle:'@',
        gridId:'@'
    }
};

选项按钮显示在标题单元格中,但是当我单击它时,我收到以下错误

[$compile:nonassign] 使用属性“行”中的表达式“未定义” 带有指令“uiGridHeaderCell”是不可赋值的!

我在 Angular 网站 link 上查看过,但不明白如何解决。

任何帮助。

【问题讨论】:

    标签: javascript angularjs ui-grid


    【解决方案1】:

    这是因为您在 headerCellTemplate 中使用了 row。在headerCellTemplate 中,您无权访问row。将您的 ng-model 更改为适当的值,它应该可以工作。

    【讨论】:

      猜你喜欢
      • 2017-08-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多