Fall in IT.

Angularjs 에러 Blocked loading resource from url not allowed by $sceDelegate policy 해결방법 본문

프레임워크/Angular Framework

Angularjs 에러 Blocked loading resource from url not allowed by $sceDelegate policy 해결방법

D.Y 2016. 11. 10. 23:02

안녕하세요.


오늘은 Angularjs에서 발생하는 "Blocked loading resource from url not allowed by $sceDelegate policy" 에러 해결방법에 대해서 알아보겠습니다.



에러상황

  • Angularjs에서 AWS S3 비디오 url 사용시 다음과 같은 에러가 발생합니다.



해결방법
  • 해당 url이 사용가능하도록 합니다.

    <Sample code>
    
    app.filter('trusted', ['$sce', function ($sce) {
        return function(url) {
            return $sce.trustAsResourceUrl(url);
        };
    }]);
    
    
    
    <video controls>
           <source ng-src="{{feed.mediaList[0] | trusted}}" type="video/mp4"/>
    </video>

참고



Comments