【发布时间】:2017-07-26 05:22:13
【问题描述】:
如果我将 div 元素放在内部 <tr> 块中,控制器将不起作用。我在这里做错了吗?
我尝试通过卡在特定索引处的 chrome 进行调试
<div ng-controller="ctrl3">
<tr>
<table cellspacing="0" cellpadding="0" style="">
<tbody>
i want to place the controller here but it doesn't show the result
<tr><td align="left"><table cellspacing="0" cellpadding="0" style="" class="celltable">
<thead>
<!--change style of column with css-->
<col >
<col >
<col >
<col >
<col >
<tr>
<th colspan="1" ng-repeat="b in buildheadings" class="Header">{{b}}</th>
</tr>
</thead>
<tbody><!--display none-->
<!--onclick-->
<tr >
<td ng-repeat="case in cases">{{case}}</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</tr>
</div>
这是 javascript 代码..
<script>
analyzer.controller('ctrl3',function($scope){
$scope.featureheadings=['Feature','Total','Passed','Failed','Random'];
$scope.buildheadings=['Build','Total','Passed','Failed','Random'];
});
</script>
另外,我可以对不同的块使用相同的控制器吗?
【问题讨论】:
-
但是如果你像在你的例子中那样将它设置为 div 是否有效?
-
是的,确实如此。 ...
-
必须是一张桌子吗? display:table、display:table-cell 和 display:table-row(在 css 中)可以工作吗?
-
不,这只是我能想到的第一件事..