Multi line textarea definition ionic2 in alert

Is there any example how to define and/or use multiline textarea in ionic2? What are the attributes? I would like to add it to an alert and define the size.

Thanks

1 Like

I would also like to know if we are able to have a textarea in an alert. I’m using alert to gather some small user input in places, so far I have a few input alerts for one word, and 1 or 2 radio button alerts, I feel that if I use a modal for the one textarea input, it will take away from the feel of my app.

I’m in the same boat. At present it doesn’t look like anything other than <input> is supported. It would be good if an Alert also supported <textarea>.

Not a very neat solution but I am using this injected into the template code towards the bottom of the file.
<template ngSwitchCase=\"textarea\">\n <div class=\"alert-input-group\">\n <div *ngFor=\"let i of d.inputs\" class=\"alert-input-wrapper\">\n <textarea [placeholder]=\"i.placeholder\" [(ngModel)]=\"i.value\" [type]=\"i.type\" class=\"alert-input\"></textarea>\n </div>\n </div>\n </template>\n\n
in the node_modules/ionic-angular/components/alerts/alert.js

Remember this will need to be re done if you update.

1 Like

I had to tweak what @vazad added:

'<template ngSwitchCase="textarea"><div class="alert-input-group"><div *ngFor="let i of d.inputs" class="alert-input-wrapper"><textarea [(ngModel)]="i.value" class="alert-input"></textarea></div></div></template>' +

Unfortunately, the enter key is still tied to the submission button. Seems like this would be fairly straightforward addition to the core, though.