suchen

Heim  >  Fragen und Antworten  >  Hauptteil

前端 - 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
                }); 
        } 
});
大家讲道理大家讲道理2744 Tage vor481

Antworte allen(1)Ich werde antworten

  • 淡淡烟草味

    淡淡烟草味2017-05-15 16:59:54

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

    Antwort
    0
  • StornierenAntwort