angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

Direct request to controller in HTML5 mode is not working

Open sandersietses opened this issue 13 years ago • 5 comments

This is my first bug I post, so I hope I'm following the guidelines correctly.

I am using AngularJS 1.1.5 and in my app.js I set the following:

$locationProvider.html5Mode(true);

I've set my redirect rules in IIS to redirect all traffic (which isn't a file) to redirect to my index.html.

When I go to the Test controller: I'd type in the url bar localhost/test. My url quickly changes to: localhost/test#test to localhost/test/#%2Ftest. When I follow links to other controllers in the app the url it works until I reach a controller with a repeater and it gives this error:

Error: 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: [["fn: function (){\n\"use strict\";\nvar a=d.url(),b=f.$$replace;if(!m||a!=f.absUrl())m++,\nc.$evalAsync(function(){c.$broadcast(\"$locationChangeStart\",f.absUrl(),a).defaultPrevented?f.$$parse(a):(d.url(f.absUrl(),b),i(a))});f.$$replace=!1;return m}; newVal: 8; oldVal: 7"],["fn: function (){\n\"use strict\";\nvar a=d.url(),b=f.$$replace;if(!m||a!=f.absUrl())m++,\nc.$evalAsync(function(){c.$broadcast(\"$locationChangeStart\",f.absUrl(),a).defaultPrevented?f.$$parse(a):(d.url(f.absUrl(),b),i(a))});f.$$replace=!1;return m}; newVal: 9; oldVal: 8"],["fn: function (){\n\"use strict\";\nvar a=d.url(),b=f.$$replace;if(!m||a!=f.absUrl())m++,\nc.$evalAsync(function(){c.$broadcast(\"$locationChangeStart\",f.absUrl(),a).defaultPrevented?f.$$parse(a):(d.url(f.absUrl(),b),i(a))});f.$$replace=!1;return m}; newVal: 10; oldVal: 9"],["fn: function (){\n\"use strict\";\nvar a=d.url(),b=f.$$replace;if(!m||a!=f.absUrl())m++,\nc.$evalAsync(function(){c.$broadcast(\"$locationChangeStart\",f.absUrl(),a).defaultPrevented?f.$$parse(a):(d.url(f.absUrl(),b),i(a))});f.$$replace=!1;return m}; newVal: 11; oldVal: 10"],["fn: function (){\n\"use strict\";\nvar a=d.url(),b=f.$$replace;if(!m||a!=f.absUrl())m++,\nc.$evalAsync(function(){c.$broadcast(\"$locationChangeStart\",f.absUrl(),a).defaultPrevented?f.$$parse(a):(d.url(f.absUrl(),b),i(a))});f.$$replace=!1;return m}; newVal: 12; oldVal: 11"]]
e.prototype.$digest@http://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:91
e.prototype.$apply@http://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:92
@http://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:61
xc/c/<@http://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:24
n@http://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:6
xc/c@http://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:24

http://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js
Line 63

In AngularJS 1.0.7 the url stays localhost/test and won't give me any errors. So there must be a regression after 1.1.5.

sandersietses avatar Jun 21 '13 10:06 sandersietses

Can you provide your code?

On 21 June 2013 11:40, Aldentev [email protected] wrote:

This is my first bug I post, so I hope I'm following the guidelines correctly.

I am using AngularJS 1.1.5 and in my app.js I set the following:

$locationProvider.html5Mode(true);

I've set my redirect rules in IIS to redirect all traffic (which isn't a file) to redirect to my index.html.

When I go to the Test controller: I'd type in the url bar localhost/test. My url quickly changes to: localhost/test#test to localhost/test/#%2Ftest. When I follow links to other controllers in the app the url it works until I reach a controller with a repeater and it gives this error:

Error: 10 $digest() iterations reached. Aborting! Watchers fired in the last 5 iterations: [["fn: function (){\n"use strict";\nvar a=d.url(),b=f.$$replace;if(!m||a!=f.absUrl())m++,\nc.$evalAsync(function(){c.$broadcast("$locationChangeStart",f.absUrl(),a).defaultPrevented?f.$$parse(a):(d.url(f.absUrl(),b),i(a))});f.$$replace=!1;return m}; newVal: 8; oldVal: 7"],["fn: function (){\n"use strict";\nvar a=d.url(),b=f.$$replace;if(!m||a!=f.absUrl())m++,\nc.$evalAsync(function(){c.$broadcast("$locationChangeStart",f.absUrl(),a).defaultPrevented?f.$$parse(a):(d.url(f.absUrl(),b),i(a))});f.$$replace=!1;return m}; newVal: 9; oldVal: 8"],["fn: function (){\n"use strict";\nvar a=d.url(),b=f.$$replace;if(!m||a!=f.absUrl())m++,\nc.$evalAsync(function(){c.$broadcast("$locationChangeStart",f.absUrl(),a).defaultPrevented?f.$$parse(a):(d.url(f.absUrl(),b),i(a))});f.$$replace=!1;return m}; newVal: 10; oldVal: 9"],["fn: function (){\n"use strict";\nvar a=d.url(),b=f.$$replace;if(!m||a!=f.absUrl())m++,\nc.$evalAsync(function(){c.$ broadcast("$locationChangeStart",f.absUrl(),a).defaultPrevented?f.$$parse(a):(d.url(f.absUrl(),b),i(a))});f.$$replace=!1;return m}; newVal: 11; oldVal: 10"],["fn: function (){\n"use strict";\nvar a=d.url(),b=f.$$replace;if(!m||a!=f.absUrl())m++,\nc.$evalAsync(function(){c.$broadcast("$locationChangeStart",f.absUrl(),a).defaultPrevented?f.$$parse(a):(d.url(f.absUrl(),b),i(a))});f.$$replace=!1;return m}; newVal: 12; oldVal: 11"]] e.prototype.$digest@ http://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:91 e.prototype.$apply@ http://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:92 @http://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:61 xc/c/<@ http://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:24 n@http://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:6 xc/c@ http://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:24

http://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js Line 63

In AngularJS 1.0.7 the url stays localhost/test and won't give me any errors. So there must be a regression after 1.1.5.

— Reply to this email directly or view it on GitHubhttps://github.com/angular/angular.js/issues/3023 .

petebacondarwin avatar Jun 21 '13 10:06 petebacondarwin

You can check this stripped version http://labs.siets.es/summary --> see that this is redirected to http://labs.siets.es/summary#%2Fsummary.

Keep clicking the links (you will go back and forth between the summary and result controller) and the error will occur.

sandersietses avatar Jun 21 '13 11:06 sandersietses

Have you tried removing the data-ng-app attribute from the HTML. Since you are manually bootstrapping with requireJS already, I suspect you might be running two copies of AngularJS, one of which is set to HTML5 mode, the other is not.

On 21 June 2013 12:36, Aldentev [email protected] wrote:

You can check this stripped version http://labs.siets.es/summary --> see that this is redirected to http://labs.siets.es/summary#%2Fsummary.

Keep clicking the links and the error will occur.

— Reply to this email directly or view it on GitHubhttps://github.com/angular/angular.js/issues/3023#issuecomment-19811042 .

petebacondarwin avatar Jun 21 '13 11:06 petebacondarwin

Thanks for the fast reply, that caused this issue! Still strange that this is not happening in AngularJS 1.0.7..

Thank you anyways!

sandersietses avatar Jun 21 '13 11:06 sandersietses

I guess this one can be closed now.

pkozlowski-opensource avatar Jun 21 '13 16:06 pkozlowski-opensource