AshBringer AshBringer - 1 year ago 81
AngularJS Question

Angularjs : Apply bold style to a character inside ng-repeat

I have a list :

$scope.list = ["test/test1/test2/test3","test3/test5/test6"];

I would like to apply bold style to
characters when displaying the list :

<div ng-repeat="path in list">
<p style="font-weight:bold">{{path}}</p>

Do you have any ideas how can I achieve this ?


Answer Source

you can do it simply with str.replace

 <p style="font-weight:bold" ng-bind-html-unsafe="csc(path)"></p>


  $ = function(path) {
    return path.replace(/\//g, "<span style='color:red'>/</span>");