Phonegap getPhoto无效

时间:2015-08-02 06:36:39

标签: javascript angularjs cordova onsen-ui

文档here效果很好,但是当我将代码添加到我的应用程序时,getPhoto部分会返回" content:// media / external / images / media / 16053'并且不会将图像加载到img元素中,它会很好地上传到服务器。它仅使用我的应用程序使用onsen会失败..

photo.html

<img src="{{ image }}" id="uploadImage">

app.js

$scope.onPhotoDataSuccess = function(fileURI) 
{
   console.log(fileURI);
   myNavigator.pushPage('photo.html', {animation : 'none'});

   $scope.image = fileURI;
}

我已尝试将模型,var属性添加到img元素,但以null响应..

1 个答案:

答案 0 :(得分:0)

在图像标记中使用ng-src而不是src,以便它将处于角度上下文中。 另外我相信fileURI是基于64的形式。所以你需要附加到数据:image / png; base64到图像源!