1

我在下面在我的HTML代码片段:角UI引导酥料饼W/HTML不正常

<a ng-href="#" popover popover-template="views/popovers/cu.html" popover-trigger="click" popover-placement="top"> 
    <img ng-src="{{chat.avatar}}" width="50" height="40"> 
</a> 

点击a标签不会触发酥料饼。 Popover在我的应用程序中没有HTML,但没有。

我已经基本上复制从这里文档的“酥料饼与模板”部分:https://angular-ui.github.io/bootstrap/#/popover

但它仍然无法正常工作,甚至在例如不之上。

怎么了?

+1

当你有''酥料饼,template''属性,也''NG-HREF =“#你不需要''popover''属性“''没有必要 –

+0

没有区别。甚至在我添加它之前它还没有工作。 – Noah

+0

当你移除''ng-href =“#”''时它有效吗? –

回答

0

试试这个:假设你没有使用脚本标记,并且你正在使用一个单独的html文件,请在你的popover-template中添加一个额外的单引号。在plunkr上查看我的示例。所以应该是popover-template="'cu.html'"而不是popover-template="cu.html"

<a ng-href="#" popover-template="'cu.html'" popover-trigger="click" popover-placement="top" > 
    <img ng-src="{{chat.avatar}}" width="50" height="50"> 
</a>  

编辑:另一种方式实现这一目标是使用脚本标记和具有“文本/ NG-模板”作为类型。该id将是您在popover-template中放置的文本。看看这个版本plunkr

所以我想看看这个:

<a ng-href="#" popover-template="'cu.html'" popover-trigger="click" popover-placement="top"> 
    <img ng-src="{{chat.avatar}}" width="50" height="50"> 
</a> 

<script type="text/ng-template" id="cu.html"> 
    <div> 
     Hey there! 
    </div> 
</script> 
+0

中的链接相同的标记没有办法。 – Noah

+0

让我再试一次.. – Petra

+0

添加了一个替代品。请参阅我的答案的编辑版本。 – Petra