I am using ng-cordova, I have stored an image in a subdirectory of cordova.file.dataDirectory
, and am unable to load it via img[src]
but I can load it via [style]
, do I have to do anything special to make it work in the img[src]
?
$scope
{
"Image":"file:///data/data/{package}/files/{subdir}/{imagename}.png"
}
Works
<div style="background-image:url({{Image}})"></div>
Doesn't work
<img src="{{Image}}" />
This was a silly error, I forgot to check my $compileProvider
service. I had it working for filesystem
but not file
.
$compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|local|data|filesystem|file):/);