Answer the question
In order to leave comments, you need to log in
How to remove escaping with angular?
have this code
<p ng-bind-html="activeProperty.details | trusted"></p>
A GREAT LOT, THIS IS THE ONE YOU\'VE BEEN LOOKING FOR
'use strict';
app
.filter('trusted', ['$sce', function ($sce) {
return function (text) {
return $sce.trustAsHtml(text);
};
}]);
YOU\'VEslash?
Answer the question
In order to leave comments, you need to log in
Search and replace?
You can make a separate filter for this :-) I
sketched an example , I have a slash and it doesn’t display like that:
<div ng-app="app">
<div ng-controller="ExampleController">
<p ng-bind-html="text | trusted"></p>
</div>
</div>
angular.module('app', []).controller('ExampleController', function($scope) {
$scope.text = "A GREAT LOT, THIS IS THE ONE YOU\'VE BEEN LOOKING FOR";
}).filter('trusted', ['$sce', function ($sce) {
return function (text) {
return $sce.trustAsHtml(text); // $sce.trustAsHtml(text.replace(/\\/g, ''));
};
}]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question