ionic 中使用 cordova camera 插件选择本地图片显示问题

OS 环境是安卓5.1.1,ionic版本是1.1,cordova版本是5.4.1
使用ngCordova中的camera插件选取本地照片并显示在页面中,图片选择没有问题,用chrome调试的时候dom中已经存在img元素并且src是选中的图片,图片资源也加载完成了,但是界面中就是不显示img的图像,整个界面就像是block住了。以下是部分代码:

HTML

<img ng-repeat="image in imageList" ng-src="{{image}}"
                 width="100" height="100"
                style="padding: 5px;">

JS

var options = {
                destinationType: Camera.DestinationType.FILE_URI,
                sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
                saveToPhotoAlbum: true,
                targetWidth: 800,
                targetHeight: 800
            };
            navigator.camera.getPicture(function (imageURI) {
                $timeout(function () {
                    $scope.imageList.push(imageURI);
                });
            }, function (error) {
                //error handle
                console.log("Error: " + error);
            }, options);
阅读 9.5k
3 个回答

更新到ionic 1.2 之后问题解决了

新手上路,请多包涵

这个问题你解决了么,我现在好像也遇到这个问题了,选择图片后页面不显示,第二次点击按钮上一次选择的图片就显示了

新手上路,请多包涵

 试试这样的h5代码:

<div ng-repeat="image in imageList">
    <img ng-src="{{image}}" width="100" height="100" style="padding: 5px;">
</div>
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题