Download files from external API


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="{{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">{{}}</span>
                    <div class="clear"></div>
                    <span class="col-50">{{}}</span>
                    <span class="col-50">{{doc.created}}</span>

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

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

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

Currently id not work

<a href="#" ng-click="'{{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…