Please remove below line from function because it throws error.
angular.element('.ac-tooltip').remove();
Because this element will be available for remove only if tool tip do not get removed itself.
If you want to remove it using remove statement then first check/ensure if element exist with that class or not then remove it.
Please remove below line from function because it throws error.
angular.element('.ac-tooltip').remove();
Because this element will be available for remove only if tool tip do not get removed itself. If you want to remove it using remove statement then first check/ensure if element exist with that class or not then remove it.