Everything works just fine, I'm now able to download the files I want, using Web API. However, my problem is: because I'm using ng-repeat in my code. As a result; the progress indicator only run on the first List item, regardless to the song I select.
I made a "fakeProgress" function to simulate a progress. But i guess you can register you .onprogress in the "download" function and update the "nhca.status" property on each "onprogress" event call.
$scope.download = function(nhac){
var id = nhac.id;
var name = nhac.name;
nhac.status = 0;
//you function to start the transfer and get the "fileTransfer" object.
fileTransfer.Onprogress= function(progressEvent) {
nhac.status = progressEvent.loaded / progressEvent.total;
};
}
Hope it helped.
希望它有所帮助。
EDIT :
To exactly fit your case use :
为了完全适合您的案例使用:
var id = nhac.SongId;
var name = nhac.SongName;
On the previous function to set the id and the name instead of my exemple. Since i had a different JSON naming it was working for me and not for you.