0
我想在我的离子应用程序中显示来自SD卡的图像,但是我遇到了使用img标记显示图像的问题。在离子应用程序中显示来自SD卡的图像
查看代码为我的应用
<ion-content ng-controller="DigitalCatCtrl">
<div>
<img ng-src="{{myimg}}" />
<img src="{{myimgs}}" />
</div>
</ion-content>
控制器代码为我的应用
.controller('DigitalCatCtrl', function($scope,$cordovaFile) {
$scope.myimg=cordova.file.externalRootDirectory + ".DigitalCatlog/ic_developmentworks.png";
$scope.myimgs="file:///storage/sdcard0/.DigitalCatlog/ic_developmentworks.png";
});
如果我有直接传递给img标签像下面这样的图像路径,图像就会显示。
<img src="file:///storage/sdcard0/.DigitalCatlog/ic_developmentworks.png" />
请告诉我我做错了什么或其他解决方案。
谢谢我的问题得到解决...... –
是绝对... –
@Vineet cordova.file.externalRootDirectory显示错误:无法读取属性“externalRootDirectory 'of undefined –