ngmodel object holds both old value and new value

13 views
Skip to first unread message

Ravi Kiran Guturu

unread,
Jul 7, 2019, 11:58:01 PM7/7/19
to Angular and AngularJS discussion
Hi,

I am facing a different issue in Angular (using v6). i am using template driven and 2 way binding.

Steps:

Submit a form with ngmodel object and got an error from REST API. User stays with same screen and modified fields with valid values and submit again.

when submitting form second time all the control values are sent as comma separated with oldvalue and new value.

ex: Lets say field Name entered as 'Ravi' on first submit and failed from Rest API and entered as 'Ravi Kiran' and submitted. here the value sent as "Ravi,Ravi Kiran"

Please let me know how do i resolve this issue.

Note: i don't want to loose my entered data and i wanted to modify and submit.

Regards
Ravikiran

Sander Elias

unread,
Jul 9, 2019, 1:15:14 AM7/9/19
to Angular and AngularJS discussion
Hi Ravi,

I have been using ngModel for a long time, and am sure it doesn't keep the old value. (at least not in the way you  are describing)
Can you show your issue in a stackblitz?

Regards
Sander
Reply all
Reply to author
Forward
0 new messages