2017-01-02 54 views
0

我有一个变量,它是这样的: -

tableData1[$scope.tableHeadingsConstant[0]] = $sce.trustAsHtml('<div class="header12" id="runTitle0" style="cursor: pointer;">' 
        + counter++ + '</div>') 

现在我想复制它,解开它,改变的DIV值,然后重新把它包。

可能吗?

回答

1

您可以使用$sce.getTrustedHtml来获取原始值。

例如:

$scope.value1 = $sce.trustAsHtml('<div>1</div>'); 

var unwrapped = $sce.getTrustedHtml($scope.value1); 

unwrapped = unwrapped.replace('1', '2'); 

$scope.value2 = $sce.trustAsHtml(unwrapped); 
相关问题