简体   繁体   中英

How to download a file while sending parameters using Angular JS

I have a php script that generates and downloads a file depending on some parameters.

How can I post those parameters and have the file to autodownload on button click.

I thought I could change the btn url every time one of those params changes, but how can I concat those parametters if most of them are arrays?

    <a class="btn_clean"
            ng-href="{{ctrl.csv_url}}"
            download="list.csv">
        Export CSV
    </a>

Is this a good way to do it?

Hey I'm not sure if you've solved this problem or not, however I believe the best way to do this would be using an angular module built just for this, ng-csv

I wrote about it in this blog post recently.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM