Imagepicker不显示图像数组。解决办法是什么?

时间:2016-01-08 06:46:00

标签: angularjs image view base64 photo-gallery

我正在使用图像选择器插件来选择图像并将其显示为幻灯片。视图部分不起作用。我只获得img图标,而不是图像。我用base64插件转换为base64。我正在研究这个问题超过一个星期。任何建议,将不胜感激。

contoller.js

  $scope.photoData = [];
   $cordovaImagePicker.getPictures(options).then(function(results) {
      function successFunc(base64) {
          console.log('photoData: ' + base64);
      }

      for (var i = 0; i < results.length; i++) {
          $scope.photoData.push(results[i]);
          window.plugins.Base64.encodeFile(results[i], successFunc);
          console.log(results[i]);
                   }
      if (!$scope.$$phase) {
          $scope.$apply();
      }
  }, function(err) {
      // An error occured. Show a message to the user
  });
                };

HTML

 <div class="list">
  <div class="item">
    <ion-slide-box>
    <ion-slide ng-repeat="item in photoData">
    <img ng-src="data:image/jpg;base64,{{item}}" style="max-width: 100%">
     </ion-slide>
    </ion-slide-box>
    </div>
  </div>

0 个答案:

没有答案