Angularjs:将粗体样式应用于 ng-repeat 内的字符

Ash*_*ger 2 css angularjs

我有一个清单:

$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)

您有什么想法我该如何实现这一目标吗?

小提琴

ase*_*rov 5

你可以简单地使用 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)