Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
AngularJS-ng绑定html不使用_Angularjs_Ng Bind Html - Fatal编程技术网

AngularJS-ng绑定html不使用

AngularJS-ng绑定html不使用,angularjs,ng-bind-html,Angularjs,Ng Bind Html,我从数据库中获取HTML数据,数据如下- "<span class=\"ui-like \" data-tipcontent=\"initialmessage\" data-contentid=\"4f3f9827-364a-41b8-adf4-a5c4ada64b8d\" data-contenttypeid=\"f7d226ab-d59f-475c-9d22-4a79e3f0ec07\" data-initialcount=\"5\" data-initialstate=\"true\

我从数据库中获取HTML数据,数据如下-

"<span class=\"ui-like \" data-tipcontent=\"initialmessage\" data-contentid=\"4f3f9827-364a-41b8-adf4-a5c4ada64b8d\" data-contenttypeid=\"f7d226ab-d59f-475c-9d22-4a79e3f0ec07\" data-initialcount=\"5\" data-initialstate=\"true\" data-readonly=\"false\" data-initialmessage=\"You and <span class="who-likes">4 others</span> like this\" data-format=\"{message}\" data-configuration=\"Format=%7Bmessage%7D\"></span>
我正在使用渲染此html,但它没有渲染整个html。这只是渲染

<div ng-bind-html="connection.LikeCountMessage" class="ng-binding">
<span class="ui-like "></span>
</div>
我期待着像这样的事情

<div ng-bind-html="connection.LikeCountMessage" class="ng-binding">
<span class="ui-like ">You and 4 other like this</span>
</div>

我该如何解决这个问题?我缺少什么?

使用ng bind html不安全而不是ng bind html

您发布的字符串不是有效字符串。它包含的HTML在另一个span的属性中有一个span。不知道你为什么期待你所期待的。