首页 > ionic cordovaImagePicker 使用

ionic cordovaImagePicker 使用

Cannot read property 'getPictures' of undefined at Object.getPictures

.controller('AccountCtrl', function($scope,$cordovaImagePicker,$ionicActionSheet,$cordovaCamera) {
  $scope.image_list = [];
  $scope.addAttachment = function() {
     nonePopover();
    $ionicActionSheet.show({
     buttons: [
       { text: '相机' },
       { text: '图库' }
     ],
     cancelText: '关闭',
     cancel: function() {
       return true;
     },
     buttonClicked: function(index) {
       switch (index){
        case 0:appendByCamera();
          break;
        case 1:
        pickImage();
        // <span style="color:#ff0000;">pickImage();</span>
          break;
        default:
          break;
       }  
       return true;
     }
   });
  }
  var pickImage = function () { 
            var options = {
                maximumImagesCount: 1,
                width: 800,
                height: 800,
                quality: 80
            };            
            $cordovaImagePicker.getPictures(options)
                .then(function (results) {                     
                     $scope.images_list.push(results[0]);  
                }, function (error) {
                    // error getting photos
                }); 
        } 
});

可能是因为你没有安装ImagePicker插件

【热门文章】
【热门文章】