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
                }); 
        } 
});
阅读 7.4k
2 个回答
新手上路,请多包涵

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

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题