【问题标题】:Angularjs : How to show Empty column using ng-class or ng-if?Angularjs:如何使用 ng-class 或 ng-if 显示空列?
【发布时间】:2016-06-28 12:16:32
【问题描述】:

我有大约 15 行 7 列显示为一个表格,每隔几行我将根据特定的分组和业务逻辑显示一个空行。标记相同的 --- 将显示整行的每列。

现在我想显示一个空列或仅显示一个空间来分隔前一行和下一行,只要有 --- ,我怎么能用 ng-classng-if 做到这一点?我正在使用引导程序。以下是我的工作代码

 <tr ng-repeat="row in ctrl.rows" class="myclass">                                            
   <td ng-repeat="col in row" ng-bind="col"></td>
 </tr>

尝试过类似的东西

<td ng-repeat="col in row" ng-bind="col" ng-class="{col == '---': 'col-sm-1'}"></td> //it didnt work

请帮忙!

【问题讨论】:

  • 试试这个
  • 谢谢,修复了语法。但是我怎样才能用空格代替 --- 呢?关于需要使用的引导类有什么想法吗?

标签: angularjs twitter-bootstrap html-table ng-class


【解决方案1】:

试试这个。您的 ng-class 语法不正确。

 <td ng-repeat="col in row" ng-bind="col" ng-class="{'col-sm-1': col == '---'}"></td>

【讨论】:

  • 您可以为此使用过滤器
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-10-03
  • 1970-01-01
  • 1970-01-01
  • 2016-12-10
相关资源
最近更新 更多