I need to create popovers that gets its content from the server.
So I created the following directive:
.directive('myPopover', [myService, function ($myService) {
return {
restrict: 'E',
transclude: true,
template: '<a href="" ng-click="wordClicked()" class="highlight" popover-trigger="manual" popover="Adequately good for the circumstances" popover-title="good enough " popover-placement="bottom" ng-transclude></a>',
link: function (scope, element, attrs) {
scope.wordClicked = function () {
if ( POPUP IS NOT SHOWING ){
var message = myService.getMessage({key: element.text()},
function () {
console.info("NEED TO SHOW POPOVER WITH "+ message);
});
}
else {
console.info("NEED TO CLOSE POPOVER");
}
}
}
}
}]);
And inside getMessage success method I need to make the popover to show.
The documentation does not give any indication for that though I found comment made
By Luthur here it seems like there is a popover-trigger="manual"
option.
Could not find a way to trigger it programmatically
Update: I tried to follow Mosho advice but I am having troubles creating a popover with the custom event trigger.
see plnkr
Thanks!