Skip to content Skip to sidebar Skip to footer

Not Getting Response When Register Is Successful

I have a Web API 2 register method as follows :- [AllowAnonymous] [Route('Register')] public async Task Register(RegisterBindingModel model)

Solution 1:

I have solved this question.

In the UserService, I needed to return

functionhandleSuccess(res) {
        return res.status;
    }

so that in the controller, I can capture the response status

functionregister() {
            UserService.createUser(vm.user)
                .then(function (response) {
                    if (response == 200) {
                        console.log('Registration successful');
                        $location.path('/registerSuccess');
                    } else {
                        errorMessages = parseErrors(response);
                        for (var i = 0; i < errorMessages.length; i++) {
                            vm.Error += errorMessages[i];
                        }

                    }
                });
    }

Post a Comment for "Not Getting Response When Register Is Successful"