[英]Customize AngularJS Bootstrap Tooltip
How do I add custom placements/animations to an AngularJS/Bootstrap tooltip? 如何在AngularJS / Bootstrap工具提示中添加自定义展示位置/动画? I can do:
我可以:
myApp.controller('TooltipCtrl', function ($scope) {
$scope.htmlTooltip = 'Here is a tooltip!';
});
And it works perfectly, but if I add: 它完美无缺,但如果我添加:
$scope.setTriggers({
placement: 'right'
});
inside the controller, I get an "undefined is not a function" error. 在控制器内部,我得到一个“未定义不是函数”错误。 What am I syntactically doing wrong?
我在语法上做错了什么?
EDIT: 编辑:
I also tried doing this: 我也试过这样做:
myApp.controller('TooltipCtrl', function ($scope) {
$scope.placement = 'right';
$scope.htmlTooltip = 'Here is a tooltip!';
});
but it seems to have no effect on the placement on the tooltip. 但它似乎对工具提示上的位置没有影响。
If you are trying to configure of the "$tooltipProvider". 如果您正在尝试配置“$ tooltipProvider”。
$tooltipProvider is a provider hence configurable only in the CONFIG Phase of angular. $ tooltipProvider是一个提供者,因此只能在CONFIG阶段的角度配置。
You will have to try it setting it in the CONFIG Phase of angular. 您将不得不尝试在CONFIG阶段设置角度。
angular.module('yourApp', ['ui.bootstrap'])
.config(['$tooltipProvider', function ($tooltipProvider) {
$tooltipProvider.options({
placement: 'right'
});
}])
Angular $tooltipProvider has been changed to $uibTooltipProvider. Angular $ tooltipProvider已更改为$ uibTooltipProvider。 Try this.
尝试这个。
angular.module('yourApp', ['ui.bootstrap'])
.config(['$tooltipProvider', function ($uibTooltipProvider)
{
$tooltipProvider.options({
placement: 'right'
});
}]);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.