Enterprise-ng: "ngModelChange" doesn't work on text change for soho-textarea

Created on 30 Jan 2019  路  5Comments  路  Source: infor-design/enterprise-ng

Describe the bug
"ngModelChange" doesn't work on text change for soho-textarea

To Reproduce
Steps to reproduce the behavior:

  1. Add "ngModelChange" event binding to soho-textarea. Also write "onTextChange()" method in typescript code to log the text change event on the console.
    <textarea soho-textarea maxlength="90" name="counter" (ngModelChange)="onTextChange()" [(ngModel)]="model.counterText"></textarea>
  1. Open browser console and run above code.
  2. Make some changes in the text area.
  3. Notice that nothing is logged in the console. That means "ngModelChange" didn't work. The event is fired after "blur". It should be fired immediately after text changes.
  4. Now make it a regular textarea by remove "soho-textearea" from the textarea markup.
  5. Run this code and type something in the text area.
  6. You will see the console log statement indicating that "ngModelChange" works successfully on regular textarea (non-soho)

Expected behavior
"ngModelChange" event binding should work for soho-textarea.

Version

  • ids-enterprise-ng: 4.10.0 and above

Platform

  • Device (if applicable) [e.g. iPhone 6 or Samsung Galaxy S6]
  • OS Version: Mac
  • Browser Name: Chrome
  • Browser Version: 71.0.3578.98 (64-bit)
[2] minor type

Most helpful comment

@hemantg05 I'm wondering if the input event would work for you? In Landmark to get around this issue, we listen on the input event and then call changeDirty() on the soho-trackdirty.directive to have the evaluation performed.

All 5 comments

We would have to have someone investigate a solution for this. Can you use the change event?

@tmcconechy, no, I can not use change event. It works the same way, i.e., change event is not triggered on text change, but rather on blur event when the text inside the textarea has changed.
The problem is (ngModelChange) is acting just like (change) event. What I am looking for is normal behaviour of (ngModelChange) so that I can immediately enable "Save" button when the text changes.

@hemantg05 I'm wondering if the input event would work for you? In Landmark to get around this issue, we listen on the input event and then call changeDirty() on the soho-trackdirty.directive to have the evaluation performed.

@fitzorama, yes, the input event works to get around this issue. Thanks for the providing this work around.

Lowering priority as there is a workaround. This came up a couple times so maybe we should try and fix it if we ever get a chance 馃憤

Was this page helpful?
0 / 5 - 0 ratings