I am looking to implement tooltips within an ng-repeat
using the angular-tooltips library. The content of the tooltips needs to be dynamic. Currently, my setup looks something like this:
View:
<div ng-repeat="region in regions">
<a tooltips tooltip-html="{{ myCtrl.generateTooltip(region) }}">HOVER</a>
</div>
Controller:
function generateTooltip(region) {
// Generate HTML content here
var content = "<b>HELLO WORLD!</b>";
return $sce.trustAsHtml( content );
}
The tooltip is displaying correctly and functioning as expected, but I am encountering the following error in the console (which is undesirable):
Error: [$parse:syntax] Syntax Error: Token '<' not a primary expression at column 1 of the expression [<b>HELLO WORLD!</b>] starting at [<b>HELLO WORLD!</b>].
- What could be causing this error in my code?
- Is it feasible to use a view as the tooltip instead of generating HTML in the controller? There exists an attribute called
tooltip-view
, but I am unsure how to pass theregion
variable to it.