2016-08-24 4 views
0

내 서버 (GET)에 AJAX 요청을 보내고 Laravel에서 렌더링 된 뷰를 가져 오려면 그 HTML을 가져 와서 'foo'라는 ID를 가진 div에 넣고 싶습니다. 어떻게해야합니까?AngularJS AJAX HTML 바꾸기

답변

1

나는 NG 바인드-HTML https://docs.angularjs.org/api/ng/directive/ngBindHtml HTML로 트릭

을 할 것입니다 믿습니다

자바 스크립트
<div ng-bind-html="myScopeVariablewithHTML"></div> 

:

$http({ 
    method: 'GET', 
    url: '/someUrl' 
}).then(function successCallback(response) { 
    $scope.myScopeVariablewithHTML = doSomethingWithResponse(response); 
    }, function errorCallback(response) { 

    });