Image at data directory not shown

I’ve download a image from server and save to my data directory by cordova-file and cordova-file-transfer plugin. The file downloaded and saved successfully. But it will not shown in my img with ng-src pointed to my data directory.

For example:

$scope.testFileDownload = function() {  
  var url = "";
  var filename = url.split("/").pop();
  var targetPath = cordova.file.dataDirectory + filename;

  $, targetPath, {}, true).then(function (result) {
    $scope.image = targetPath;
  }, function (error) {
  }, function (progress) {


<img ng-src="{{image}}">
<button class="button button-full button-positive" ng-click="testFileDownload()">Test download</button>

If I set the image to a remote url, it will be fine. But it won’t work if I set it to my local data path like:


It works at device and android emulator. Don’t know why doesn’t work at ios simulator.

Actually it also works in ios. It’s not shown only when I run it by:

ionic emulate ios -lc

Strange problem.