I tried both \n and < br/ >, but unfortunately not working!
Is this Possible ?
//Displaying toast to welcome user!
let user = this.currentUser();
//console.log(user);
let toast = Toast.create({
message: 'Hi ' + user.email + '! <br/> Welcome to My App',
duration: 5000,
position: 'bottom'
});
toast.onDismiss(() => {
console.log('Dismissed toast');
});
this.nav.present(toast);
Actually it IS possible. You can do the following:
.toast-message {
white-space: pre;
}
and \n
for a line-break.
Note: Take a look at home.ts
and style.css
.
See working plunkr
Although @iWork solution works for many situation but if you have close
button in your toast it will be pushed out of screen.
So you can use these style sheet instead:
.toast-message {
white-space: pre-line;
}
p.s you need to use \n
for line break in your string
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With