I have a text input which when focused(read:typed in) shows a dropdown containing an anchor element.
And when the input loses focus, a function is fired using ng-blur
as follows:
Markup:
<input type="text" ng-blur="hideDropdown()" ng-focus="getDropdownData()" />
Function:
scope.hideDropdown = function() {
scope.hide_dropdown = true;
}
As you can see in the function, I set a variable hide_dropdown
to true which in turn hides a dropdown containing an anchor element defined as follows:
<div ng-hide="hide_dropdown">
//other li(s)
<li>
<a ng-href="remote_url" download>
Download
</a>
</li>
</div>
The problem I am facing is that I need to download a file using the anchor element mentioned. But when I click on the anchor element, instead of downloading the file, ng-blur
takes precedence and hides the anchor element(using the function) and consequently, the file isn't downloaded.
How can I give more priority to ng-href? I need the file to be downloaded first and then ng-blur
to be fired.