Skip to content Skip to sidebar Skip to footer

Form Is Not Clearing Values In Success Function Of $.ajax, Using Angular

I have a form in that, I am using angualr.js. I am binding input values to angular variables. After submitting form, in success function of $.ajax, I am assigning empty values to t

Solution 1:

Don't mix angular with jQuery for manipulating scope variables, it will messed up with digest cycle of angular. It will not run digest cycle if you do update scope variable from jQuery.

You need to run digest cycle by calling $apply() over $scope after your method clear() in Ajax success to fix it issue quickly, but ideally I wouldn't prefer go for this approach.

Instead do use $http instead of $.ajax.

Post a Comment for "Form Is Not Clearing Values In Success Function Of $.ajax, Using Angular"