AngularJS+;Twitter Popover:内容迭代

AngularJS+;Twitter Popover:内容迭代,angularjs,twitter-bootstrap,popover,Angularjs,Twitter Bootstrap,Popover,我使用了一个带有popover的twitter引导程序,并得到了一个AngularJS作用域变量,以便正确显示。下面的方法很有效 (data-content="{{notifications[0].user}} shared {{notifications[0].user_two}}'s records") 当我添加以下内容时 (data-content="<b>{{notifications[0].user}} shared {{notifications[0].user_two

我使用了一个带有popover的twitter引导程序,并得到了一个AngularJS作用域变量,以便正确显示。下面的方法很有效

(data-content="{{notifications[0].user}} shared {{notifications[0].user_two}}'s records")
当我添加以下内容时

(data-content="<b>{{notifications[0].user}} shared {{notifications[0].user_two}}'s records</b>")
(数据内容=“{{notifications[0].user}}}共享{{{notifications[0].user{two}}的记录”)
不会显示错误,但所有{}}不再呈现

所以我试着把它作为一种测试

(data-content="<div ng-repeat='item in notifications'>test {{item}} <br/><hr/></div>")
(data content=“test{{{item}}

与上一个示例非常相似,我看到的是“test”,而不是{{item}。“测试”只显示一次,即使通知有三个元素。当我看到DOM时,有一个

<div class="popover-content">
    <div ng-repeat="item in notifications">you  <br><hr></div>
</div>


我还尝试创建一个指令来遍历数组并生成所需的输出,但是我试图将数据内容设置为指令的结果失败了。我在其他地方找到的例子我相信会起作用,但我只是想在开始实现类似()或()的东西之前确认一下,我没有错过一个简单的解决方案来解决我上面概述的问题,而不需要我创建一个指令

编辑:


Plunkr Url可能会破坏它,请尝试使用$sce将其标记为受信任的html

$scope.html='
  • 请呈现给我
; $scope.trustedHtml=$sce.trustAsHtml($scope.html);
请创建一个plunker您是否使用ui引导?创建了一个plunkr,不,我没有使用ui引导。只是标准的Bootstrap,然后是标准的角度。如果你决定使用UI引导程序(我强烈推荐它),那么我可以为你提供我认为的“丢失”的POPOFE指令——HTML PopFor、HTML不安全的POFOVER、模板POPORE和从另一个元素中提取内容的POPORE,哦,当用户在popover外单击时,会出现一个全局popover closer。这肯定是jquery造成的问题,因为正如您在下面的plunker中所看到的,angular在迭代数组时没有问题:您可以尝试使用部分内容而不是数据内容来提供html吗?
$scope.html = '<ul><li>render me please</li></ul>';
$scope.trustedHtml = $sce.trustAsHtml($scope.html);

<button ... data-content="trustedHtml" ...> </button>