首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >动态剑道表列模板中的Angular指令

动态剑道表列模板中的Angular指令
EN

Stack Overflow用户
提问于 2017-05-17 13:53:05
回答 1查看 527关注 0票数 0

我有一个在角度控制器上创建的动态剑道表,该表是在单击事件之后创建的,在一些表列中有angular指令。指令没有编译,模板不工作,我得到了空白单元格。代码:

代码语言:javascript
复制
   $("#grid" + index).kendoGrid({
    dataSource: {
        transport: {
            read: {
                url: context.param.url.GetData(),
                type: "post",
                dataType: "json",
                data:
                    function () {
                        return {
                            FromDate: obj.CalcDate,
                            ToDate: obj.CalcDate,

                        }
                    }
            }
        },
        schema: {
            data: "Data",
            total: "Total"
        },
        pageSize: 5,
        serverPaging: true,
        serverSorting: true,
        serverFiltering: true
    },
    scrollable: false,
    sortable: true,
    pageable: true,

    columns: [

       {
           field: "AgregationProgramSum",
           title: resource["Productivity_Company_GridAgregationProgramSum"],
           template: "<div custom-directive=#: AgregationProgramSum # ></div>"
       },

    ]
    });

我在《合唱揭秘》中看到,这些价值观很好。bur指令没有发生

EN

回答 1

Stack Overflow用户

发布于 2017-05-19 01:27:03

你的指令的代码在哪里?您应该只需要在网格的模板中“使用”您的指令。

以下是我的指令:

代码语言:javascript
复制
     angular.module("KendoDemos")
        .directive('myDirective', function($compile) {
  return {
    restrict: 'E',
    scope: {
      list: '='
    },
    template: '<div ng-repeat="item in list">{{item.name}}</div>',

    replace: true,
    //require: 'ngModel',
    link: function($scope, elem, attr, ctrl) {

    }
  };
});

下面是我的网格列using指令:

代码语言:javascript
复制
                columns: [{
                field: "FirstName",
                title: "First Name",
                width: "120px"
                },{
                field: "LastName",
                title: "Last Name",
                width: "120px"
                },{
                field: "Country",
                width: "120px",
                  hidden: true
                },{
                field: "City",
                width: "120px"
                },{
                field: "Title",
                  template:  "<my-directive data-list='paint'></my-directive>"

            }],

这是有效的Dojo。也许你的指令有问题。很难在实际看到你的代码的时候说出来。希望这能有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44016626

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档