Download files from external API

Hello

Currently, i have a list with href items, these items download external files, for example

Item 1 -> Download file
Item 2 -> Download another file

<ion-view view-title="Documents" hide-back-button="false">

    <!--docs section-->
    <ion-content id="docs-content">

        <div class="documentos padding">
            <a href="https://servername.com/api/document/download/id/{{doc.id_document}}?__token=the_token&__idPortal=1" ng-repeat="doc in docs">
                <i class="fa fa-file"></i>
                <div class="filename">
                    <span class="title col-100">{{doc.name}}</span>
                    <div class="clear"></div>
                    <span class="col-50">{{doc.name}}</span>
                    <span class="col-50">{{doc.created}}</span>
                </div>
            </a>
        </div>

    </ion-content><!--end docs section-->
</ion-view>

On browser (using ionic serve) works fine, but on run android, on click not download file.

Any idea?

In advance thank you

You must use cordova-plugin-file-transfer to do such of things.
Remember that you are developing an app not just a webpage, you can start learning how to use the cordova-plugin-file-transfer form here
cordova-plugin-file-transfer

You probably just need to whitelist the domain using the Cordova whitelist plugin.

Okay, i consider use inappbrowser

But, how to pass id (data from items) on window.open?

Currently id not work

<a href="#" ng-click="window.open('https://www.domain.com/api/document/download/id/{{doc.id_document}}?__token=the_token&__idPortal=1', '_system', 'location=yes'); return false;" ng-repeat="doc in docs">

my suggestion is do a method in your controller and pass the data from the parameter…