<a data-ng-href="" uib-popover-template="'profile.html'" popover-placement="bottom"></a>
<script type="text/ng-template" id="profile.html">
<div class="media">
<div class="media-left">
<a data-ng-href="">
<img class="media-object" data-ng-src="" alt="">
</a>
</div>
<div class="media-body">
<h4 class="media-heading" data-ng-bind="mainCtrl.Authentication.getUser().fullName">Unknown User</h4>
</div>
</div>
</script>
错误
Error: Syntax error, unrecognized expression: <div class="media">
<div class="media-left">
<a data-ng-href="">
<img class="media-object" data-ng-src="" alt="">
</a>
</div>
<div class="media-body">
<h4 class="media-heading" data-ng-bind="mainCtrl.Authentication.getUser().fullName">Unknown User</h4>
</div>
</div>
at Function.Sizzle.error (jquery.js:4421)
at tokenize (jquery.js:5076)
at select (jquery.js:5460)
at Function.Sizzle [as find] (jquery.js:3998)
at jQuery.fn.extend.find (jquery.js:5576)
at jQuery.fn.jQuery.init (jquery.js:196)
at jQuery (jquery.js:62)
at compile (angular.js:7543)
at ui-bootstrap-tpls.js:4688
at processQueue (angular.js:14792)
我创建了一个带有 Bootstrap 组件的模板,并且我正在使用此模板来创建 Bootstrap 弹出窗口。有人可以纠正我的错误
最佳答案
我今天遇到了这个问题,当我准备发布同样的问题时,当我输入帖子标题时,我遇到了 this post .这又让我找到了jquery documentation .
本质上我所做的就是去掉模板中的空格,效果很好。即:
之前:
<script type="text/ng-template" id="deletePopover.html">
<div>Sample template.</div>
</script>
之后:
<script type="text/ng-template" id="deletePopover.html"><div>Sample template.</div>
</script>
由于 Angular UI Bootstrap 不依赖于 jQuery,我不知道为什么这是一个问题,而且我还没有真正研究过它为什么有效,所以我想我会同时发布它。
关于javascript - 带模板的 Angular ui bootstrap 弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34833186/