AngularJS: How to download a PDF file from the link with the download attribute?

Good time of day.
Faced a problem, prompt the decision.

Buck - Laravel 5.x at the front, Angular 1.5.x (for routing at the front I use ui-router).

There are PDF files that are stored on the server in the folder stock_files. You need to make a link, clicking on it should work. On windows, the below given works, on MacOS there is a redirect to:

The link is formed like this:
<a ng-if="" ng-href="stock_files/{{}}/{{}}" download target="_blank" ng-bind="f.original_name">
where the is the id of the flow, - the name of the file.

On MacOS (Safari) the error is not coming opens a new tab and there is a redirect to state 'admin.redirecthome', the file is not downloaded. Windows opens a new tab in the browser, the file is downloaded, the tab is closed.

in any case, with the hope that if download doesn't work, the file opens in the browser in a new tab. Tried to remove the attribute download and set target="_self", on MacOS also does not work.

In the config of the front installed:
<base href="/">,
so links work with account domain name.

Someone faced with a problem, tell me solution please.
July 9th 19 at 13:25

Find more questions by tags AngularHTMLJavaScript