1

I have an image :

<img data-ng-src="C:/var/vci/images/fleetImages/{{img.imageName}}" data-ng-type="{{img.imageType}}"/>

On html I am getting it as:

unsafe:c:/var/vci/images/fleetImages/IMG_20150912_091552.jpg

I have added in app.js

.config(['$compileProvider', function ($compileProvider) {
     $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|local|data):/);
}]);

but still I am getting same issue. Help me fix this issue.

Pankaj Parkar
  • 134,766
  • 23
  • 234
  • 299
Er KK Chopra
  • 1,834
  • 8
  • 31
  • 55

1 Answers1

0

You'll need to whitelist the file: protocol.

.config(['$compileProvider', function ($compileProvider) {
  $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|local|data|file):/);
}]);

You should also consider using a relative path instead of a absolute local filesystem path.

Please see Angular changes urls to "unsafe:" in extension page and unsafe link in angular for more info.

Community
  • 1
  • 1
twernt
  • 20,271
  • 5
  • 32
  • 41