Search code examples
angularprimengtoast

use html in primeng p-toast


I would like to use html code
in primeng toast module. I have tried different options but cannot get it to work.

this.messageService.add({ sticky: true, severity: 'error', summary: 'Import job', detail: 'first line of text <br\>second line of text'});

anyone suggestions?


Solution

  • Actually you can with a little tick in CSS, declaring this in your main sylesheet:

    .ui-toast-detail {
       white-space: pre-line;
    }
    

    Now yours \n will work in the message :)