Javascript 为什么不';t在Ionic中使用$cordova文件显示图像
我是一个新的离子显影剂。我在测试cordova文件插件时遇到问题。 我正在尝试显示要存储在本地文件系统中的图像。 我可以使用$cordova文件获取图像对象 但这张照片并没有显示在视野中 controller.jsJavascript 为什么不';t在Ionic中使用$cordova文件显示图像,javascript,angularjs,cordova,ionic-framework,Javascript,Angularjs,Cordova,Ionic Framework,我是一个新的离子显影剂。我在测试cordova文件插件时遇到问题。 我正在尝试显示要存储在本地文件系统中的图像。 我可以使用$cordova文件获取图像对象 但这张照片并没有显示在视野中 controller.js var fname = "001.jpg"; $cordovaFile.checkFile(cordova.file.externalCacheDirectory, fname) .then(function(obj) { $scope.img_u
var fname = "001.jpg";
$cordovaFile.checkFile(cordova.file.externalCacheDirectory, fname)
.then(function(obj) {
$scope.img_url = obj.nativeURL;
$scope.$apply();
}, function(error) {
alert(JSON.stringify(error));
});
template.html
<img ng-src="{{img_url}}"/>
救救我!致以最诚挚的问候。您可能需要在应用程序的配置部分使用以下代码:
.config(['$compileProvider', function($compileProvider) {
$compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|content|file|blob|data):/);
}])
在我的应用程序中,我使用类似的
$compileProvider.ahrefsanitationwhitelist()
来允许与数据uri方案或Blob的链接。您在控制台日志中看到哪种警报/错误?我看不到任何日志。只有我确认使用警报窗口获取了正确的nativeUrl。请检查我的问题: