Ng-grid不能与文件引用的单元格模板一起工作

ng-grid does not work with file-referenced cell template

本文关键字:一起 工作 单元格 不能 文件 引用 Ng-grid      更新时间:2023-09-26

我使用angular-js + ng-grid,对于一些列,我想使用单元格模板。但是由于某些原因,当template-html作为文件存储和引用时,它不希望工作。

    columnDefs: [ { 
       field: "Foo", 
       displayName: "Foo", 
       cellTemplate: '<div class="ngCellText"><input type="text" ng-model="row.entity[col.field]"/> </div>' 
    }] // OK
    columnDefs: [ { field: "Foo", displayName: "Foo", cellTemplate: 'cellTemplate.html' } ]
    // Error: [$parse:syntax] Syntax Error

此外,如果我从他们的网站上链接到plunkr,我看到它不起作用。

似乎工作,如果你给外部模板另一个名字比一个已经在$templateCache

    $scope.gridOptions = {
    data: 'myData',
    columnDefs: [{
        field: 'name',
        displayName: 'Name'
    }, {
        field: 'age',
        displayName: 'Age',
        cellTemplate: "exCellTemplate.html"
    }]
    };
工作恰好