问题
At present I am using $cordovaImagePicker plug-in. I am manually selecting images. My requirement is to display all images from mobile like a gallery App.
$cordovaImagePicker.getPictures(options)
.then(function(results,afterLoop) {
var arrayItems=[];
for (var i = 0; i < results.length; i++) {
$scope.images.push(results[i]);
}
}, function(error) {
});
This loads gallery images in a popup where they can be selected. I don't want any popup instead just read all images from phone automatically when page load. Can someone please guide me to the right direction.
回答1:
$scope.selectImage = function () {
var options = {
maximumImagesCount: 10, // count of images you want to select
width: 300,
height: 300,
quality: 100
};
$cordovaImagePicker.getPictures(options)
.then(function (results) {
$scope.imageList = results;
console.log('gallery data: ' + angular.toJson(results));
console.log(results);
for (var i = 0; i < results.length; i++) {
$scope.imageList.push(results[i]);
}
}, function (error) {
console.log(error);
});
}
来源:https://stackoverflow.com/questions/35357588/read-all-images-from-gallery-in-ionic-app