angular-notifier
angular-notifier copied to clipboard
How to display a message of multi lines?
How to display a message of multi lines?
I have tried
this.notifier.notify('error', 'HELLO, World<br/>line2\nline3');
all don't work.
By default, the notification title can only be a string. Otherwhise, we would have to circumvent the integrated Angular XSS protection.
You could, though, use a custom template to use custom HTML, such as line breaks. See:
- Docs: https://github.com/dominique-mueller/angular-notifier#custom-templates
- Example (in the demo project): https://github.com/dominique-mueller/angular-notifier/blob/develop/projects/angular-notifier-demo/src/app/app.component.ts#L63
What if I'm using it as a global service, from where I do the notifier.show() instead from the component? Have I to pass the template from every component that use it? Or am I missing something?
I'm using at the moment this workaround:
::ng-deep .notifier__notification-message {
white-space: pre-line;
}