iOS device not updating ngModel in text input


<ion-textarea type="text" rows="0" placeholder="Type your message" [(ngModel)]="message"></ion-textarea>

This works fine in browser and on android, but I am unable to get it to work on iOS 11.2 device. I get message as undefined.

If I only use <textarea> without ‘ion’ it works fine with no issues.

Any suggestions?

Try giving the textarea a name attribute.

By the way, are you testing this in a release build? If using the emulator or ionic serve, you should be seeing an error message about the missing name attribute.

There are no errors in ionic serve or web browser testing. It works as expected on Android device and in web browsers as a production release.

The only issue is with iOS on device. The only error I could track down in xcode is this:

API error: <_UIKBCompatInputView: 0x1017286a0; frame = (0 0; 0 0); layer = <CALayer: 0x1c003d4e0>> returned 0 width, assuming UIViewNoIntrinsicMetric

I don’t know enough about Obj-C to know if that’s related.

Did you add the name attribute?

If you can run the iOS Simulator, try ionic cordova emulate ios -l -c and see if you get any logs thrown in your terminal.

There is something new?

Nothing new, my solution was simply to not use <ion-textarea> and to use <textarea> instead. The name attribute made no difference.