JSFiddle - React, Tailwind, and code Playground
by DineshAngappa
HTML
<div ng-app="SampleApp" ng-controller="myController">
<div>
{{item.description}}
<br/> {{item.id}}
<br/> {{item.name}}
<br/> {{item.continent|noCarriageReturn}}
<br/> <span ng-bind-html="item.content"></span>
</div>
</div>
JavaScript
var sampleApp = angular.module("SampleApp", ['ngSanitize']);
sampleApp.controller('myController', function($scope) {
$scope.item = {
"description": "Description of the country USA \r\n",
"id": 12,
"name": "UgSA\r\n",
"continent": "North of America",
"content": "<h2>This is test</h2>"
}
});
sampleApp.filter('noCarriageReturn', function() {
return function(value) {
return (!value) ? '' : value.replace(/(\r\n|\n|\r)/gm, "");
};
});