I have an AngularJS Directive that attaches jQuery Tooltipster to elements in a ng-repeat
like so:
View:
div.chat-wrapper
ul.chat-messages
li(ng-repeat='chat in chatmessages' chat-tooltip)
Directive:
angular.module('app')
.directive('chatTooltip',
function() {
return {
restrict: 'A',
link: function(scope, el, attrs) {
scope.mute = function() {
console.log('hello world');
};
$(el).tooltipster({
content: $('<button ng-click="mute()" class="btn">Mute</button>'),
position: 'left',
positionTracker: true,
trigger: 'hover',
interactive: true,
autoClose: false
});
}
};
}
);
I want to call the mute()
function defined in the scope
or $scope
- ? Since the plugin adds the HTML content in the directive - I'm not sure what I need to do?