I have an array of data that I want to display in a tooltip. That being said, it seems that the tooltip expects a single long string of input. I joined my array by commmas but when I send it in, I want to display it as a list, not a long string.
Here is an example of my situation:
In my controller:
$scope.data = ["foo","bar","fubar"];
In the template:
<label for="test">
<input tooltip id="Test" type="text" title="{{data.join()}}">
</label>
In the directive:
link: function(scope, element, attrs){
// i have my data array back, but not sure how to display it as a list
var dataArray = attrs.title.split(",");
element.tooltip(); //gives foo,bar,fubar in the tooltip
}
Basically, in my tooltip, I want a list like a rendered version of this:
<ul>
<li>foo</li>
<li>bar</li>
<li>fubar</li>
</ul>
I just needed to adjust the tooltip handler to add custom HTML.
And then just use
.join('<br/>')
on the array.See the jQuery API Documentation for more stuff.
See this Working Demo.