Angularjs UI自举 - 把HTML中酥料饼 [英] Angularjs ui bootstrap - put html inside popover

查看:122
本文介绍了Angularjs UI自举 - 把HTML中酥料饼的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是官方角度引导指令的。

我想用它的popovers的。

I want to use of of it's popovers .

在文档它说,如果你想插入酥料饼里面的html,你应该使用酥料饼-HTML ,像波纹管:

In the documentation it says that if you want to insert html inside the popover you should use popover-html, like bellow :

     <button popover-html="{{getTag()}}" type="button" class="btn btn-default">Dynamic Popover</button>
     <button popover-html="<a>Just fucin show me !</a>" type="button" class="btn btn-default">Click me </button>

但是,这将引发以下控制台错误:

But this will raise the following console error :

错误:[$解析:语法]语法错误:令牌'&LT;'不是主要的前$的前pression [sdfsdfsdf]开始[sdfsdfsdf] 1 P列$ pssion。
  的http://errors.angularjs.org/1.4.3/$parse/syntax?p0=%3C&p1=not%20a%20primary%20ex$p$pssion&p2=1&p3=%3Ca%3Esdfsdfsdf%3C%2Fa%3E&p4=%3Ca%3Esdfsdfsdf%3C%2Fa%3E

Error: [$parse:syntax] Syntax Error: Token '<' not a primary expression at column 1 of the expression [sdfsdfsdf] starting at [sdfsdfsdf]. http://errors.angularjs.org/1.4.3/$parse/syntax?p0=%3C&p1=not%20a%20primary%20expression&p2=1&p3=%3Ca%3Esdfsdfsdf%3C%2Fa%3E&p4=%3Ca%3Esdfsdfsdf%3C%2Fa%3E

您可以看到 plunker

感谢

推荐答案

只需卸下支架和 $编译功能:

HTML

<button popover-html="getTag()" type="button" class="btn btn-default">Dynamic Popover</button>

JS:

$scope.getTag = function(){
   return '<a>sdfsdfsdf</a>';
}

这篇关于Angularjs UI自举 - 把HTML中酥料饼的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆