Force HTTP interceptor in dynamic ngSrc request

后端 未结 4 1091
一整个雨季
一整个雨季 2020-12-03 03:53

I\'ve created an AngularJS application that loads images from an OAuth secured backend. My OAuth library is configured by adding an extra interceptor to the Angular $h

4条回答
  •  执笔经年
    2020-12-03 04:02

    As said here you can use angular-img-http-src (bower install --save angular-img-http-src if you use Bower).

    If you look at the code, it uses URL.createObjectURL and URL.revokeObjectURL which are still draft on 19 April 2016. So look if your browser supports it.

    In order to use it, declare 'angular.img' as a dependency to your app module (angular.module('myapp', [..., 'angular.img'])), and then in your HTML you can use http-src attribute for tag.

    In your example, you can write:

提交回复
热议问题