My journey with coding Angular started not too long ago.
I have a HTML structure with various divs and classes. I am looking to loop through these classes and add a tooltip to a specific div within each class. Rather than hardcoding the Angular attributes directly in the HTML, I would like to dynamically generate them to keep the code cleaner.
For instance, by using:
button.setAttribute("tooltip-placement", "bottom");
However, Angular seems to ignore this and sticks to the default placement: top.
How can I convince Angular to recognize my customized handling of Angular attributes?
Thank you!
The directive below, which manipulates the DOM, hasn't yielded the desired results: even though it appears in the DOM when inspected, Angular chooses to overlook it. The objective was to display a tooltip upon hover.
demoApp.directive('tooltipView', function () { return { restrict: 'EA',
link: function (scope, element, attrs) {
element.attr("tooltip-placement", scope.placement);
element.attr("tooltip-html-unsafe", "testtooltip");
element.attr("tooltip-trigger", "mouseover");
}
};
})