-
Notifications
You must be signed in to change notification settings - Fork 3.4k
md-maxlength doesn't update immediately if model content is updated in javascript #1870
Comments
+1 still present in current master. $setPristine(); and $setUntouched() have no effect. |
+1 (any work-around for now ?) |
here is the plunker for work around. |
👍 Still not working. If like me, you have a clearForm function, you might not want the watch from gauravbhavsar's example. Simply make your md-maxlength get the length from your controller:
And then in your clearForm() method, reset the maxLength (like the watch does) (example is ES6):
|
👍 An easy work around for this is to also include the ng-maxlength attribute like so...
... this appears to 'work' better however highlights another issue that I have raised here #5853 |
+1 |
Anyone got this thing fixed. I am facing the same issue |
@ThomasBurleston this is fixed in a new release? |
Still happening for me. |
@steve-mcqs This issue was closed by our Spring Cleaning. But as I'm able to reproduce that bug, I'll reopen that issue. |
* Currently the md-maxlength char counter was not updated properly and listening on the different events is unnecessary. ngModelController will already update the model, when the `input` event gets called. Additonally we can cover all updates in the $validator itself, because it will always update, when changes get applied to the model. Fixes angular#1870.
* Currently the md-maxlength char counter was not updated properly and listening on the different events is unnecessary. ngModelController will already update the model, when the `input` event gets called. Additonally we can cover all updates in the $validator itself, because it will always update, when changes get applied to the model. Fixes angular#1870.
* Currently the md-maxlength char counter was not updated properly and listening on the different events is unnecessary. ngModelController will already update the model, when the `input` event gets called. Additonally we can cover all updates in the $validator itself, because it will always update, when changes get applied to the model. Fixes angular#1870.
Ok, I don't know if it helps You, but for me fix like this works:
This is a part of directive so thats the reason i use name variable. You just have to trigger(Handler) input event. |
I wrote a simple code that could solve this problem in your view: in your controller: var fakeMaxLen; // call this function after your data model was changed and you need to update char counter // you can disable animation of .md-errors-spacer class and set visibility to hidden, when process started |
* Currently the md-maxlength char counter was not updated properly and listening on the different events is unnecessary. ngModelController will already update the model, when the `input` event gets called. Additonally we can cover all updates in the $validator itself, because it will always update, when changes get applied to the model. Fixes #1870.
Steps to reproduce:
issue - the couter of characters used next to the text area will not update, it will stay as 32/500 for example. It will only update once the user starts typing again.
This is in version 0.7.1
The text was updated successfully, but these errors were encountered: