HTML (Jade):
a(href='#', data-placement='right', title="{{ someArrayOfStrings }}" tooltip)
where someArrayOfStrings
is declared given a value during initialization in my angular controller:
Angular:
var myController = function($scope) {
$scope.initialize = function(someArrayOfStrings) {
$scope.someArrayOfStrings = someArrayOfStrings;
}
};
var tooltip = function() {
return {
restrict: 'A',
link: function(scope, element, attrs){
$(element).hover(function(){
$(element).tooltip('show');
}, function(){
$(element).tooltip('hide');
});
}
};
};
Currently, this would give my tooltip content such as the following:
["string1","string2","string3"]
which is ugly as hell and totally NOT what I want.
What I want displayed is something like this:
string1
string2
string3
I have searched around and it seems like there are quite a few approaches to this but so far, I have not managed to get it to work nicely, e.g. http://jsfiddle.net/superscript18/fu7a2/6/, http://jsfiddle.net/WR76R/ and Render Html String in tooltip.
Alternatively, I could perhaps use a concatenated string delimited by <br/>
tags. This would require that my tooltips accept HTML tags, however. There seems to be an tooltip option available, i.e. html: true
, but I can't get it to work.
Ideas / Help?
Demo fiddle @ jsfiddle.net/zr89sq6L/6/