How to implement File Downloading from server?

How to implement File Downloading from server?

A little context would help in answering your question… What are you trying to achieve?

@coen​_​warmer - There is some file on server. In my app there is a download button . After click on download button pdf/ppt file should be download in device with loader using ionic for windows phone 8.

It’s important to understand that Ionic in itself doesn’t have the functionality to write files to the filesystem of a device. Ionic on a device runs on top of Cordova, and Cordova has plugins that expose certain device level functionality to the html based app like the filesystem.

For what you want I would suggest first looking into the Cordova File system plugin: http://cordova.apache.org/docs/en/3.3.0/cordova_file_file.md.html

Specifically the write file method:

function win(writer) {
    var data = new ArrayBuffer(5),
        dataView = new Int8Array(data);
    for (i=0; i < 5; i++) {
        dataView[i] = i;
    }
    writer.onwrite = function(evt) {
        console.log("write success");
    };
    writer.write(data);
};

var fail = function(evt) {
    console.log(error.code);
};

entry.createWriter(win, fail);

@coen​_​warmer Cordova file download i know. But, I am facing the problem in integration cordova code in ionic framework. Can you tell me ? How to implement in cordova functionality in ionic?

Use file-tranfer plugin, gives progression as well. Initiate with button push, use progression callback for visual presentation. You need to dive into ionic to make both good looking…

@svdoever:-
If you have file-tranfer plugin with ionic example please share …

Now, File is downloading using cordova plugin in windows phone8. But i am not able to find where file being downloaded. Because, after downloading i want to open that file. Can any one help me?