This solution does not use Angular-UI, only Angular and Bootstrap. Bootstrap is not necessarily required, it simply simplifies the process:
http://plnkr.co/edit/jLThSTrLUapAG8OLW44m?p=preview
Before moving on, an alternative to this example would be to add a CSS class with word-wrap and white-space for your tooltip class. Using the Chrome or Firefox developer tool, check the items until you find the classes responsible for customizing the ui tooltip; then add these properties to your own style.css CSS document.
Now, for this particular solution, we create a tooltip directive and let it accept the placement attribute to determine the positioning
Angular, where we destroy the tooltip after we are done to prevent a memory leak:
var app = angular.module('test', []); angular.module('test').directive('tooltip', function () { return { restrict: 'A', link: function (scope, element, attrs) { $(element) .attr('title', attrs.tooltip) .tooltip({placement: attrs.placement}); scope.$on('$destroy', function() { element.tooltip('destroy'); }); } } })
CSS where we have to override some default values ββfor Bootstrap:
.tooltip-inner { width: auto; min-width: 180px; background-color: #c0d3d2; color: #000000; font-weight: 600; margin: 0 5px 0 -5px; } .tooltip.in { opacity: 1.8; filter: alpha(opacity=100); } .tooltip.bottom .tooltip-arrow { top: 0; left: 50%; margin-left: -5px; border-bottom-color: #c0d3d2; border-width: 0 5px 5px; }
source share