2016-08-24 1 views
0

私のサーバー(GET)にAJAXリクエストを行い、Laravelからレンダリングしたビューを取得したい場合は、そのHTMLを取り出してidの 'foo'を持つdivに貼り付けたいどうすればいいですか?AngularJS AJAX HTMLを置換する

答えて

1

私はNG-バインドHTML https://docs.angularjs.org/api/ng/directive/ngBindHtml HTMLでトリック

を行います信じる:

JavaScriptで
<div ng-bind-html="myScopeVariablewithHTML"></div> 

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

    }); 
関連する問題