0

I'm going crazy with this after searching for two days, I really hope someone can help.

I have an AngularJS project using gulp. From here I call a basic method to execute and http post to my c# API like so:

var $http({ url: serverAddress + '/api/general/sendemail', dataType: 'json', data: '', headers: { "Content-Type": "application/json" }

Whenever I call this method (or any method using $http), it seems to execute the call twice on the server.

The strange thing is that it only does it from AngularJS.

If I run it on postman, it executes only once.

Any ideas?

2
  • What makes you think this executes the call twice on the server? BTW, this code is incomplete. Commented Sep 28, 2018 at 13:13
  • Can you provide the part of code where this $http method is invoked? Is it a Controller or a Service? Commented Sep 28, 2018 at 13:19

1 Answer 1

1

Thanks for the feedback, guys.

It seems that it was only when I was serving the page from gulp that it was behaving this way. I uploaded to IIS and it worked as expected.

Regarding your comments, it was sending the email twice every time I clicked the send button, and it was a controller and not a service.

Thanks

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.