Ionic Info
Run ionic info from a terminal/cmd prompt and paste the output below.
Ionic:
ionic (Ionic CLI) : 4.1.1 (C:\Users\Jorge\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.0.0-beta.13
@angular-devkit/core : 0.7.5
@angular-devkit/schematics : 0.7.5
@angular/cli : 6.2.5
@ionic/ng-toolkit : 1.1.0
@ionic/schematics-angular : 1.0.7
Cordova:
cordova (Cordova CLI) : 8.1.2 ([email protected])
Cordova Platforms : android 7.0.0, browser 5.0.3
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 1.2.1, (and 19 other plugins)
System:
Android SDK Tools : 26.1.1 (C:\Users\Jorge\AppData\Local\Android\Sdk)
NodeJS : v10.12.0 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10
Describe the Feature Request
It would be neat if the Alert message string supported multilines, either by an array of string or with newline characters (e.g: rn).
Currently, if you try to introduce a message with newlines, the newlines will get replaced by spaces and all of the text will be next to each other.
Describe Preferred Solution
On the ion-alert component, either have multiple divs for each line, or separate each line by a paragraph element, so that the newlines get respected.
Describe Alternatives
None.
Related Code
const alertController = document.querySelector('ion-alert-controller');
await alertController.componentOnReady();
const alert = await alertController.create({
header: 'Alert',
subHeader: 'Subtitle',
message: 'This is an alert message with multiple lines.\nLine 2.\nLine 3.',
buttons: ['Okay']
});
await alert.present();
Additional Context
None
Did you try <br> instead "n" ?
Did you try
<br>instead "n" ?
Just tried it, and it does work. But I'd say to add support to string newlines nonetheless.
I think this is related because the message use html and in html there is no n - so i close this here
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Most helpful comment
Did you try
<br>instead "n" ?