javascript - 如何将primeng确认框消息打破到单独的行?

标签 javascript angular typescript element primeng

任何人都可以给我建议来打破确认框消息。

我已经尝试过下面的代码。但它显示 br 标签作为字符串。还有其他方法可以解决这个问题吗?

this.confirmationService.confirm({
                    message: 'CoC updated successfully' + '</br>' + ' Do you want to close or continue working with this?',
                    icon: 'fa fa-question-circle',
                    header: 'Confirm Save',
                    accept: () => {
                       this.infomessage = [];
                        this.infomessage.push({ severity: 'success', summary: '', detail: Updated Successfully' });                    },
                    reject: () => {
                        this.router.navigate(['versions']);
                    }
                });

最佳答案

是的,我通过以下步骤得到了它。

步骤 1

我们需要搬家{{message}}到里面<pre>标记在 confirmdialog.metadata.json文件。就像,

<span class=\"ui-confirmdialog-message\"><pre>{{message}}</pre></span>

步骤 2

我们应该添加 white-space: pre-line在这个类(class).ui-confirmdialog-message 。就像,

.ui-confirmdialog-message {
       white-space: pre-line;
}

步骤 3

Then if you add \n, then we can break the message. like, message : updated successfully \nDo you want to close or continue working with this

<小时/>

希望这个答案对某人有所帮助

关于javascript - 如何将primeng确认框消息打破到单独的行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44316427/

相关文章:

javascript - 如何使 jquery pubsub 作为 requirejs 模块工作

javascript - 在适合我的网页的链接上扩展搜索栏

forms - maxlength 属性的 Angular 验证消息

angular - 如何获得父组件注入(inject)器?

angular - "Ionic dev app"和 "real mobile phone"上的空白屏幕

Apollo 的 TypeScript 类型使用Mutation 的 refetchQueries?

typescript - TypeScript 中的 Mongoose 自定义查询助手

javascript - Angular 对象数组值抛出未定义错误

javascript - 在 Javascript 中创建和使用模块

javascript - 在 JavaScript 中使用微秒精度的日期范围