I am trying to use multiple filters as shown below
<p><span ng-bind-html="someVar | nl2br | linky"></span></p>
which does nothing. However, when I change the order of the filters as shown below
<p><span ng-bind-html="someVar | linky | nl2br"></span></p>
linky works, but nl2br cannot convert line breaks to br.
For nl2br, you can use the following implementation:
.filter('nl2br', function($sce) { return function(input) { return $sce.trustAsHtml( input.replace(/\n/g, '<br>') ); } }
source share