AngularJS 교차 도메인 포함 > 퍼블리싱강좌

퍼블리싱강좌

AngularJS 교차 도메인 포함 정보

AngularJS AngularJS 교차 도메인 포함

본문

AngularJS 교차 도메인 포함

기본적으로 ng-include 지정 문에서는 다른 도메인의 파일을 포함 할 수 없습니다.

다른 도메인의 파일을 포함 시키려면 응용 프로그램의 구성 기능에 법적 파일 및 / 또는 도메인의 화이트리스트를 추가하십시오.

예:
<body ng-app="myApp">

<div ng-include="'https://tryit.w3schools.com/angular_include.php'"></div>

<script>
var app = angular.module('myApp', [])
app.config(function($sceDelegateProvider) {
    $sceDelegateProvider.resourceUrlWhitelist([
        'https://tryit.w3schools.com/**'
    ]);
});
</script>

</body>



[전체소스]
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body ng-app="myApp">

<div ng-include="'https://tryit.w3schools.com/angular_include.php'"></div>

<script>
var app = angular.module('myApp', [])

app.config(function($sceDelegateProvider) {
  $sceDelegateProvider.resourceUrlWhitelist([
    'https://tryit.w3schools.com/**'
  ]);
});

</script>

</body>
</html>
추천
0
  • 복사

댓글 0개

© SIRSOFT
현재 페이지 제일 처음으로