For all your usual Bootstrap popover tasks, you can use the following angular directive. It removes clutter from the HTML template and is very easy to use.
You can configure the popover title , content , placement , fade in / out delay , trigger event and whether the content should be treated as html . It also prevents content overflow and clipping.
Associated plunker with all codes here http://plnkr.co/edit/MOqhJi
Screencap

Using
<div ng-model="popup.content" popup="popup.options">Some element</div> /* JavaScript */ this.popup = { content: 'Popup content here', options: { title: null, placement: 'right', delay: { show: 800, hide: 100 } } };
Javascript
app.directive('popup', function() { return { restrict: 'A', require: 'ngModel', scope: { ngModel: '=', options: '=popup' }, link: function(scope, element) { scope.$watch('ngModel', function(val) { element.attr('data-content', val); }); var options = scope.options || {} ; var title = options.title || null; var placement = options.placement || 'right'; var html = options.html || false; var delay = options.delay ? angular.toJson(options.delay) : null; var trigger = options.trigger || 'hover'; element.attr('title', title); element.attr('data-placement', placement); element.attr('data-html', html); element.attr('data-delay', delay); element.popover({ trigger: trigger }); } }; });
Mikko Viitala Jan 28 '15 at 10:17 2015-01-28 10:17
source share