import { Pipe , PipeTransform } from '@angular/core' ; @ Pipe ( { name : 'nl2br' , } ) export class Nl2brPipe implements PipeTransform { static replace ( text ) { return typeof text === 'string' ? text . replace ( /\n/g , '<br>' ) : '' ; } transform ( text ) { return Nl2brPipe . replace ( text ) ; } }