简体   繁体   English

Angular-UI引导程序不适用于模板

[英]Angular-ui bootstrap don't work correctly with templates

I use angular-ui-bootstrap popover. 我使用angular-ui-bootstrap popover。 I manually changed template of popover to support html in it. 我手动更改了popover模板以在其中支持html。 I changed ng-bind to ng-bind-html: 我将ng-bind更改为ng-bind-html:

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

I'm passing such template to popover attribute: 我正在将这样的模板传递给popover属性:

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

So {{somethingFromScope}} resolves and works, but ng-click function doesn't work. 因此{{somethingFromScope}}可以解决并起作用,但是ng-click函数不起作用。 ng-show , ng-if (looks like any ng- directive) don't work as well. ng-showng-if (看起来像任何ng-指令)都无法正常工作。

What's the reason of it? 是什么原因呢? How can I make it work? 我该如何运作? Thanks 谢谢

Just changing template is not enough 仅更改模板是不够的

Update module dependencies like this: 像这样更新模块依赖性:

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

And change template 并更改模板

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

Works with angular.ui.bootstrap v0.11.0 from 2014-05-01 从2014-05-01开始与angular.ui.bootstrap v0.11.0一起使用

After researching a lot I find a solution: 经过大量研究后,我找到了解决方案:

If you need popover with template - use AngularStrap popover ;) 如果您需要带有模板的弹出窗口-请使用AngularStrap popover;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM