我动态获取我的数据,所以它总是不同的。
我使用 .replace
将 ngStyle
添加到表中,但我如何为第一个 child (称为 td)提供样式?
我做了一个plunker所以你可以尝试一些东西。
最佳答案
你可以使用 ng-style
有条件地添加一个类,就像这样
<td ng-class="{'firstchild': 'someConditionGoesHere'}">Ali</td>
但是要为第一个 td 添加样式,您必须坚持使用基本的 css,例如
.tableStyle td:first-child
您还可以做的是使用 ng-style 添加一个类 say 'test' 并具有类似
的 css 定义.tableStyle td.firstchild:first-child {}
将这些组合在一起会为您解决。
关于javascript - 使用 ngStyle 将样式分配给 tr :first-child td,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34155903/