我有一个清单:
$scope.list = ["test/test1/test2/test3","test3/test5/test6"];
Run Code Online (Sandbox Code Playgroud)
我想在显示列表时对字符应用粗体样式:/
<div ng-repeat="path in list">
<p style="font-weight:bold">{{path}}</p>
</div>
Run Code Online (Sandbox Code Playgroud)
您有什么想法我该如何实现这一目标吗?
你可以简单地使用 str.replace http://jsfiddle.net/k18vgtvw/
<p style="font-weight:bold" ng-bind-html-unsafe="csc(path)"></p>
Run Code Online (Sandbox Code Playgroud)
控制器
$scope.csc = function(path) {
return path.replace(/\//g, "<span style='color:red'>/</span>");
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16515 次 |
| 最近记录: |