I'm currently using $http.get
to retrieve the data from the backend. The data received is actually in HTML format; however, it comes back escaped with \t\n and all the white spaces. If I were to perform the same $.get
request using jQuery, the data that comes back comes unescaped. Anyway how I can use get the raw unescaped HTML? I've tried $sce.trustAsHtml
with no avail.
I don't know how you are getting the response, because you have not shared any code.
How are you getting the data?
I use $http
to get raw HTML templates without any issue:
$http.get('url').then(function(response) {
var raw_html = response.data;
});
add ngSanitize
inject $sce
and use
$scope.rawHtml = $sce.trustAsHtml(html)
<div ng-bind-html="rawHtml"> <div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With