Put a line break (newline) into a toastr message in AngularJS?

无人久伴 提交于 2019-11-30 17:28:38
jaycer

There are two ways to allow some HTML tags, including line breaks, in a toast.

Include 'body-output-type': 'trustedHtml' in toaster-options:

<toaster-container toaster-options="{
    'closeButton': false,
    'debug': false,
    'position-class': 'toast-bottom-right',
    'onclick': null,
    'showDuration': '200',
    'hideDuration': '1000',
    'timeOut': '5000',
    'extendedTimeOut': '1000',
    'showEasing': 'swing',
    'hideEasing': 'linear',
    'showMethod': 'fadeIn',
    'hideMethod': 'fadeOut', 
    'body-output-type': 'trustedHtml'
}"></toaster-container>

Or include 'trustedHtml' in a call to toaster.pop():

toaster.pop('success', 'Saved', 'Saved<br/>it!', 3000, 'trustedHtml');

or

toaster.pop({
    type: 'success',
    title: 'Saved',
    text: 'Saved<br/>it!',
    bodyOutputType: 'trustedHtml'
});

Source

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!