html是这样的
- 深圳
- 广州
- 北京
- 上海
...
- 天津
- 杭州
- 西安
- 厦门
中间还有几十个li,后台传过数据来,确定具体是哪个城市被选中,得到相应的n值,转换成相应的css代码应该是这样的。
.li:nth-child(n){color:red}
用angularjs怎么把这条样式,写进页面中去呢?求大神抬一手
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
<li ng-repeat="..." style="{{$index===n ? 'color: red' : ''}}">xx</li>