Closed christopherbahr closed 10 years ago
Awesome, thanks!
How can I use this option?
When you're writing your link: function you just swap template for templateUrl and give it a string with your tooltip in it. Just make sure you have a div with class tooltip surrounding it. Something like
app.directive('myTooltip', function($tooltip) {
return {
restrict : 'EA',
link : function(scope, elem) {
var tooltip = $tooltip({
target: elem,
scope: scope,
template: '<div class="tooltip"> This is my tooltip </div>',
});
elem.hover(function(){
$scope.apply(tooltip.open);
}, function () {
$scope.apply(tooltip.close);
});
}
};
});
Thanks!
On Fri, Jul 18, 2014 at 3:05 PM, christopherbahr notifications@github.com wrote:
When you're writing your link: function you just swap template for templateUrl and give it a string with your tooltip in it. Just make sure you have a div with class tooltip surrounding it. Something like
app.directive('myTooltip', function($tooltip) { return { restrict : 'EA', link : function(scope, elem) { var tooltip = $tooltip({ target: elem, scope: scope, template: '
This is my tooltip', }); elem.hover(function(){ $scope.apply(tooltip.open); }, function () { $scope.apply(tooltip.close); }); } }; });— Reply to this email directly or view it on GitHub https://github.com/remind101/angular-tooltip/pull/4#issuecomment-49428147 .
Probably not useful for most people but I needed it in my project.