How to download Image in Local Storage in Ionic?

I have some records and each record has an image.I want to give option to the users that he can download the image in its Phone gallery.I tried Cordova File Transfer plugin but did not succeed.

$scope.download = function() {
var url = “http://papers.com.pk/xads/2015/8-6/Nawa-e-waqt/ad_img-epaper_id-7541-epaper_page_id- 102532-584325.jpg.gif”;
var targetPath = cordova.file.dataDirectory + “/Usman/” + “testImage.png”;
var trustHosts = true
var options = {
saveToPhotoAlbum: true,
};
$cordovaFileTransfer.download(url, targetPath, options, trustHosts)
.then(function(result) {
// Success!
alert(“Download”);
}, function(err) {
// Error
alert(“Not Download”);
}, function (progress) {
$timeout(function () {
$scope.downloadProgress = (progress.loaded / progress.total) * 100;
})
});

}, false);

})
}

I tried this code.How can i Download the file?

Thanks

Have a look at these articles:

http://devdactic.com/complete-image-guide-ionic/



http://www.clearlyinnovative.com/ionic-framework-camera-image-uploads-and-base64-strings/

I tried all these but no success