How to download(save) an image from url into our photo album using angularjs?

Viewed 1649

I am new to angularjs and my project runs on android and IOS platform using angularjs and ionic. I need to save an image into phone photo album(support IOS and Andorid) with the image url. I know cordova plugins can download images from url but I can't understand how to install cordova-plugin-file-transfer. Is there any other easier way to achieve this function? Thanks.

angular.module('myApp', []);

angular.module('myApp').controller('HomeCtrl', ['$scope', '$http', function($scope, $http) {

  $scope.saveImg = function(imgUrl){
   var hideSheet = $ionicActionSheet.show({
                        buttons: [
                            {text: 'save image'},
                            {text: 'copy link'},
                        ],
                        cancelText: 'cancel',
                        cancel: function () {
                        },
                        buttonClicked: function (index) {
                            if (index == 0) {//save image here
                               
                            }
                        }
                    });

  }
 
}]);
<img ng-src="{{imgUrl}}" on-hold="saveImg(imgUrl)">

1 Answers
Related