I\'m trying to convert newline characters (\\n
) to html br
\'s.
As per this discussion in the Google Group, here\'s what I\'ve got:
Instead of messing with new directives, I decided to just use 2 filters:
App.filter('newlines', function () {
return function(text) {
return text.replace(/\n/g, '
');
}
})
.filter('noHTML', function () {
return function(text) {
return text
.replace(/&/g, '&')
.replace(/>/g, '>')
.replace(/
Then, in my view, I pipe one into the other: