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