Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
ajax request is looping in Angularjs

Hi I am developing Angularjs application. I am making ajax call to server to get some details. Request is POST. Code written for Ajax is looping and it is not stopping.

(function () {
    angular.module('RoslpApp').controller('ChangePassword', ['$scope', '$http', '$translatePartialLoader', '$translate', '$state', '$stateParams', 'cfg', 'toastr',
        function ($scope, $http, $translatePartialLoader, $translate, $state, $stateParams, cfg, toastr) {
            var url = cfg.Baseurl + "api/Customer/ResetPassword";
            //  alert(SomeFactory.getData());
            var url = cfg.Baseurl + "api/Customer/ModifyPassword";
            var ID = $stateParams.LoginID;
            debugger;
            //this loops and never stops
            $scope.changePassword = function () {
                var resetpassword = {
                    ID: ID,
                    NewPassword: $scope.otpnewpassword
                };
            $http.post(url, resetpassword).then(function (response) {

            }, function (error) {

            });
            }
        }]);
})();

This is my html code.

<div class="body-wrapper background-pattern">
    <div class="form-wrapper">
        <div class="form-container">
            <h2 class="form-header">Change Password</h2>
            <div class="form-row">
                <div class="inputblock">
                    <span class="input-icon"><img src="images/lock-icon.png"></span>
                    <input type="password" class="with-icon" placeholder="New Password" ng-model="newpassword">
                </div>
                <div class="inputblock">
                    <span class="input-icon"><img src="images/lock-icon.png"></span>
                    <input type="password" class="with-icon" placeholder="Confirm Password">
                </div>
            </div>
            <div class="button-container">
                <input type="button" value="Change Password" id="input-submit" ng-bind="changePassword()">
                <input type="submit" value="Cancel" id="input-cancel">
            </div>
        </div>
    </div>
</div>

I am not sure why Ajax call is looping. May I get some help here to fix this? Any help would be appreciated. Thank you.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You are using ng-bind with a function, ngBind attribute tells AngularJS to replace the text content of the specified HTML element Try ng-click instead of that.

<input type="button" value="Change Password" id="input-submit" ng-bind="changePassword()">

to

  <input type="button" value="Change Password" id="input-submit" ng-click="changePassword()">
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!