Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

148
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda