Javascript 如何在angularjs中实现html格式的字符串

Javascript 如何在angularjs中实现html格式的字符串,javascript,jquery,angularjs,Javascript,Jquery,Angularjs,我正在使用angularjs。这里我有一个从数据库中提取的字符串,它是html格式的,如下所示 $scope.data = '<p>this is first line </br> this is second line</p>'; 它实际上没有html格式,就像 <p>this is first line </br> this is second line</p> 使用$sce: $scope.data = $sce.

我正在使用angularjs。这里我有一个从数据库中提取的字符串,它是html格式的,如下所示

$scope.data = '<p>this is first line </br> this is second line</p>';
它实际上没有html格式,就像

<p>this is first line </br> this is second line</p>
使用$sce:

$scope.data = $sce.trustAsHtml('<p>this is first line </br> this is second line</p>');
$scope.data=$sce.trustAsHtml(“这是第一行
这是第二行

”);
HTML


使用$sce:

$scope.data = $sce.trustAsHtml('<p>this is first line </br> this is second line</p>');
$scope.data=$sce.trustAsHtml(“这是第一行
这是第二行

”);
HTML


使用$sce:

$scope.data = $sce.trustAsHtml('<p>this is first line </br> this is second line</p>');
$scope.data=$sce.trustAsHtml(“这是第一行
这是第二行

”);
HTML


使用$sce:

$scope.data = $sce.trustAsHtml('<p>this is first line </br> this is second line</p>');
$scope.data=$sce.trustAsHtml(“这是第一行
这是第二行

”);
HTML



你可以使用Angular的$compile工具,你可以找到文档。

你可以使用Angular的$compile工具,你可以找到文档。

你可以使用Angular的$compile工具,你可以找到文档。

你可以使用Angular的$compile工具,您可以找到文档。

使用,但我想在内部使用它。是否可以这样做?{{user.post_title}{{user.post_content}}我实际上想在{{user.post_content}中使用它但是我想在里面用它,在里面重复。这有可能吗?{{user.post_title}{{user.post_content}}我实际上想在{{user.post_content}中使用它但是我想在里面用它,在里面重复。这有可能吗?{{user.post_title}{{user.post_content}}我实际上想在{{user.post_content}中使用它但是我想在里面用它,在里面重复。这有可能吗?{{user.post_title}{{user.post_content}}我实际上想在{{user.post_content}中使用它