ng-click inside bs-tooltip not working

人盡茶涼 提交于 2019-12-12 02:48:58

问题


I'm using angular-strap tooltip and inside I have link that should react to ng-click, but instead it's not responding.

.html

<span class="add-on input-group-addon" data-title="{{tooltips.date}}" bs-tooltip>
  <i class="glyphicon glyphicon-calendar fa fa-calendar"></i> Dates
</span>

.js

$scope.tooltips = {
  date: '<a class="btn btn-default" ng-click="select()">Select date</a>'
};

$scope.select = function() {
  //doing something and works fine outside tooltip
}

In app .config() there is html set to true.

angular.extend($tooltipProvider.defaults, {
  template: "static/lib/angular-strap/tooltip.tpl.html",
  trigger: 'click',
  html: true,
  placement: 'bottom-left'
});

回答1:


By using data-title along with html: true you are just passing some html, but it is not compiled by angular. If you want to use angular directives and data binding in your tooltip, use 'contentTemplate'; here is a working plunker: http://plnkr.co/LSl9gyHRKCMYoEGZZQei



来源:https://stackoverflow.com/questions/23949431/ng-click-inside-bs-tooltip-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!