In our application(It's an angularJs), we have "uib-tooltip" in so many places, So I want it to make it a simple piece of code that can automatically add "aria-describedby" attribute to the DOM if "uib-tooltip" is there.
Asked
Active
Viewed 543 times
1
-
It is a good idea to show what you have tried, you won't get many favourable responses from people if you only ask how to do something. Have a go and then post some code for us to help you with. At least post a snippet of what a "uib-tooltip" structure would look like in your code for people who don't use angularJS. – GrahamTheDev Mar 12 '20 at 11:52
-
Likely a [custom directive](https://stackoverflow.com/questions/17063000/ng-model-for-input-type-file-with-directive-demo/43074638#43074638) could do that. – georgeawg Mar 12 '20 at 13:23
1 Answers
1
You can add attributes to the element that has the uib-tooltip directive on it. Just add the "uibTooltip" to a module of yours. This will add additional functionality on top of what the library does.
.directive('uibTooltip', function () {
return {
link: function (scope, element, attrs) {
attrs.$set('aria-describedby', 'Whatever text you want.');
}
}
})

FrancisA
- 146
- 1
- 9