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개

전체 283
퍼블리싱강좌 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT