Join GitHub today
Compare strings without converting to number, "77" not equals to "077" #2000
I have a problem with text field updating. I found this issue while tesing zip code field.
Reporting a bug
How would you reproduce the current behavior (if this is a bug)?
To reproduce bug need to enter numeric string with leading zeros f.e. "0077" and store survey data (go to next page).
Then if we return to previous page and change input value to "77" or "077" and try to update survey result no changes will be stored.
What is the current behavior?
If we return we'll see "0077" in this input.
What is the expected behavior?
Value must be changed
I think the problem is in unstrict comparing in change detection.
Please check it.
Thank You for fast reply!
I'll try to illustrate in this fork - https://next.plnkr.co/edit/JWeYKRAmb6fMjw1A?preview
Please, take attention to onValueChanged callback fireing.
I'm using backend storage and synchronize data on page changing.
I apologize - I inadvertently saved this.
Thank you for your comment
@xxxKOTxxx What is wrong with your plunker? I added debugger; into onValueChanged event. The debugger stopped two times as well as in onValueChanging. Everything works as expected.
PS: We have several unit tests on this functionality. It is unlikely that it is broken.
@andrewtelnov, sorry - I had no time to create more clear plunker.
Try this one https://next.plnkr.co/edit/0BdxsoQx5DqwJPiG
I added normal output and steps to reproduce.
I hope it's enough to understand what is wrong. Maybe I don't understand something - if so, I'll be glad if You point out my error.