Get image from file.dataDirectory returns 404 not found (after normalizeURL)


I’m trying to show a image in my view which is stored in the dataDirectory of the app. But when I set the image in the src tag, it returns a 404.

First I save the image returned from an api into the dataDirectory and normalize the URL:

this.file.writeFile(this.file.dataDirectory, filename, blob, { replace: true })
.then(function(fileEntry) {
	store.photoData = normalizeURL(fileEntry.nativeURL);

The normalized url of the image looks like this:


Then I use it in my view:

<img *ngIf="store.photoData" [src]="store.photoData" />

Any ideas how to use a local resource image in a src tag? I don’t want to convert it back to base64.


Yes! Found the answer myself!