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:
$urlRouterProvider.otherwise("/admin/redirecthome");

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

Used
target="_blank"
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:
$locationProvider.html5Mode(true);
and
<base href="/">,
so links work with account domain name.

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

Find more questions by tags AngularHTMLJavaScript