Angular ui bootstrap don'不能正确使用模板

Angular-ui bootstrap don't work correctly with templates

本文关键字:不能 bootstrap ui don Angular      更新时间:2023-09-26

我使用角度ui引导popover。我手动更改了popover的模板以支持其中的html。我将ng-bind更改为ng-bind-html:

<div class='"popover-content'" ng-bind-html='"content'"></div>

我正在将这样的模板传递给popover属性:

<span ng-click="scopeFunction()">{{somethingFromScope}}</span>

因此{{somethingFromScope}}解析并工作,但ng-click函数不工作。ng-showng-if(看起来像任何ng指令)不能很好地工作。

这是什么原因?我怎样才能让它工作?感谢

仅仅更改模板是不够的

更新模块依赖项如下:

  angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip', 'ui.bootstrap.bindHtml'])

并更改模板

  <div class="popover-content" bind-html-unsafe="content"></div>

适用于angular.ui.bootstrap v0.11.0,从2014-05-01

经过大量研究,我找到了一个解决方案:

如果你需要带模板的popover-使用AngularStrap popover;)