Here is a code snippet:
private mDialog: MatDialog,
const dialog = new MatDialogConfig();
msg = "I enjoy coding in Angular.\r\n I am learning TypeScript."
dialog.data = {
message:msg
};
alert (msg);
mDialog.open(ABCCustomDialogComponent, dialog);
After trying to alert the string 'msg', it displays a line break in the alert message window like this:
I enjoy coding in Angular
I am learning TypeScript
However, when displayed in the dialog box, the message does not show the line break. The output appears as follows:
I enjoy coding in Angular. I am learning TypeScript
Attempts with br
and div
tags did not result in printing the line break in the dialog box output.
Any ideas on what could be going wrong?