相关疑难解决方法(0)

表格行作为指令显示在angularjs的表格上下文之外

我有一张桌子,每一行都要使用指令和ng-repeat显示。

不幸的是,这些行是在表上下文之外呈现的。

请在这里运行小提琴:http : //jsfiddle.net/nu1tu9qL/4/

指令:

.directive('myrow', [function () {
        return {
            restrict: 'E',
            replace: true,
            scope: {
                rowdata: "="
            },
            template: '<tr><td>{{rowdata.a}}</td><td>{{rowdata.b}}</td></tr>',
        };
    }]);
Run Code Online (Sandbox Code Playgroud)

HTML:

<table>
    <thead>
        <th>A</th>
        <th>B</th>
    </thead>
    <tbody>
        <myrow ng-repeat="d in data" rowdata="d"></row>
    </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

angularjs angularjs-directive

1
推荐指数
1
解决办法
720
查看次数

标签 统计

angularjs ×1

angularjs-directive ×1