Grow ion-textarea automatically on every new line input

With the current ion-textarea, we can specify the number of rows but it must be hard coded. I’m looking for a way to set the number of rows depending on the content. If it must take 10 lines, then I should have 10 rows.

In Ionic 3, I followed the example from Josh Morony ( Lesson 14: Creating an Autogrow Directive for a Textarea) but it doesn’t work anymore.

Thanks

@olivier_p
this worked for me

<ion-textarea #mytextarea placeholder=“Type your message”>

resize() {
let textArea = this.mytextarea[‘_elementRef’].nativeElement.getElementsByClassName(“text-input”)[0];
textArea.style.overflow = ‘hidden’;
textArea.style.height = ‘auto’;
textArea.style.height = textArea.scrollHeight + “px”;
}

It didn’t work for me. Are you using Ionic 4 beta11?