Sunday, March 12, 2017

Why my angular app send many request in Internet Explorer

Leave a Comment

I'm working with my Angular application in Chrome and IE. Although in Chrome in run very fast, in IE my Angular app very slow.

I just debug my application in IE and Chrome and see IE send many request but Chrome only send 1.

In Chrome:

enter image description here

In IE:

enter image description here

This is code I implement this function:

vm.save = function () {         // Logic here          ConfigFactory.api.update({}, ConfigFactory.data[0], function (response) {             vm.showSuccess = true;             vm.oldConfigs = angular.copy(vm.configs);              $timeout(function () {                 vm.showSuccess = false;             }, 1000)              $window.location.href = '#/Home';         });     } 

Please give me advice for this issue.


UPDATED: After I do not clear when navigation in IE:

enter image description here

IE still send many request.

This is error log.

enter image description here

This log only appear in IE, Chrome have nothing Please help me check it.

2 Answers

Answers 1

As far as I can see, the problem is that your code is going into an infinit loop and reloading angular context over and over again. When you use $window.location you are reloading your application - why not to use routing system to avoid reloading? And if you need data saved, then store it in a service, and re-fetch it from that service from the home route controller.

Answers 2

Don't use $window.location. here if you use routing concept i think you not facing the problem.

See angular route details

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment