2017-02-09 2 views
0

인 ionic1보기에서 http.get 요청의 변수에 캡처 된 HTML 표시 ionint보기에서 각도가있는 HTTP 요청으로 캡처 된 HTML 페이지를 tryintg 할 때 문제가 있습니다.각도가

내 컨트롤러 코드 :

app.controller('MiNegocioCtrl', function ($scope, ajax, $sce) { 
    ajax.sendApiRequest({}, "GET", url, true).then(function (response) { 
     $scope.data = response.data; 

     console.log(response.data); 
     var negocio = angular.element("#negocio"); 
     negocio.html(response.data); 
    }, function (error) { 
     _showPopUp('error', 'error'); 

    }); 
}) 

내보기 코드 :

// In your controller, inject the $sce service, and mark the HTML as "trusted": 
.controller('MiNegocioCtrl', function($scope, $http, $sce) { 
    $scope.data = ""; 

// make request with service $http 
    $http.get(url).then(function (response) { 
    $scope.data = $sce.trustAsHtml(response.data); 
    }); 

}) 

로보기 :

<ion-view title="Negocio" id="page10"> 
    <ion-content> 
     <div id="negocio" style="width: 100%;height: 100%"></div> 
    </ion-content> 
</ion-view> 

답변

0

내가 내 대답은 아래에 당신을 도울 수 있도록 노력하겠습니다. 지시문 ng-bind-html을 사용하십시오.

<ion-view title="Negocio" id="page10"> 

    <ion-content> 
     <div ng-bind-html="data" style="width: 100%;height: 100%"></div> 
    </ion-content> 

</ion-view> 
+0

감사합니다.하지만 같은 오류가 있습니다 !!! 나는 그 코드를 테스트하고 있었다 !! @Andrei –

+0

Cannor 읽기 속성 'classList'of null @Andrei –