3

I'm working with my Angular application in Chrome and IE. Although in Chrome it runs very fast but in IE my Angular app is very slow.

I just debug my application in IE and Chrome and see IE send many requests but Chrome only sends 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';
        });
    }

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

enter image description here

IE still send many requests.

This is the error log.

enter image description here

This log only appear in IE, Chrome have nothing

Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
Tran Vinh Quang
  • 585
  • 2
  • 9
  • 30
  • You don't just happen to have the IE equivalent of *"Preserve log"* on, do you? – Phil Mar 06 '17 at 03:40
  • ... I think it's called [*"Clear entries on navigate"*](https://learn.microsoft.com/en-us/microsoft-edge/f12-devtools-guide/network) – Phil Mar 06 '17 at 03:53
  • can you show the error in the console for IE ? – user1496463 Mar 06 '17 at 06:04
  • @Phil I have update as your request. Help me check this. – Tran Vinh Quang Mar 06 '17 at 06:32
  • @MrBones, I have update log. Can you help me check this. It only appear in IE. Chrome have nothing – Tran Vinh Quang Mar 06 '17 at 06:32
  • Looks like some issue with how you rendered the content. check [this link](http://stackoverflow.com/questions/17116114/how-to-troubleshoot-angular-10-digest-iterations-reached-error) and see if it helps – user1496463 Mar 06 '17 at 07:29
  • Is there any chance that when you navigate to `#/Home`, the method `save` is fired again? So it will create infinite loop. Check this out it may relate to your issue: `http://stackoverflow.com/questions/10201809/ie-incompatability-with-window-location-href` – haipham23 Mar 07 '17 at 14:29
  • There are chances your method is called repeatedly ..so it repeatedly try to redirect,hence multiple calls. Take a look at this you will understand -http://stackoverflow.com/questions/17116114/how-to-troubleshoot-angular-10-digest-iterations-reached-error – Namdeo Karande Mar 08 '17 at 09:49
  • What version of IE is that? – Pytth Mar 09 '17 at 18:42

2 Answers2

6

As far as I can see, the problem is that your code is going into an infinite 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.

iCollect.it Ltd
  • 92,391
  • 25
  • 181
  • 202
1

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

See angular route details

Srikrushna
  • 4,366
  • 2
  • 39
  • 46