0

We are updating to html5Mode. It appears that everything is fixed. All the old links work, which is great, but if the user tries to go to the plain domain with the /#/at the end, it triggers an infinite digest. Has anyone seen this before? Is there a setting I can apply that will force angular to rerender to the newer link without causing an error?

.config(['$locationProvider', function ($locationProvider) {
            $locationProvider.html5Mode(true)
        }])

angular.js:13424 Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: []
http://errors.angularjs.org/1.5.3/$rootScope/infdig?p0=10&p1=%5B%5D
    at angular.js:68
    at Scope.$digest (angular.js:16907)
    at Scope.$apply (angular.js:17133)
    at done (angular.js:11454)
    at completeRequest (angular.js:11652)
    at XMLHttpRequest.requestLoaded (angular.js:11593)

I have added the base tag to the head, and provisioned both our development, QA and production servers to serve the static files and for all other links to serve the index.

Works: domain.com/# Redirects to: domain.com

Works: domain.com/#/path Redirects to domain.com/path

Also works domain.com/#/ (eventually, anyhow, but not until after generating a few infinite digest errors)

Kraken
  • 5,043
  • 3
  • 25
  • 46
  • Welcome to [so]! At this site you are expected to try to **write the code yourself**. After **[doing more research](//meta.stackoverflow.com/questions/261592)** if you have a problem you can **post what you've tried** with a **clear explanation of what isn't working** and providing a [**Minimal, Complete, and Verifiable example**](//stackoverflow.com/help/mcve). I suggest reading [ask] a good question and [the perfect question](http://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/). Also, be sure to take the [tour] and read **[this](//meta.stackoverflow.com/questions/347937/)**. – Alon Eitan May 03 '17 at 13:57
  • 1
    Which code exactly would you like me to post, since it affects the entire application? @AlonEitan – Kraken May 03 '17 at 14:03
  • That's a bit tricky, but it's impossible to guess without any code. Make sure you read and implemented it [as the docs suggest](https://docs.angularjs.org/api/ng/provider/$locationProvider), perhaps it's on the `web.config` or `.htaccess` side - But again, pretty hard to tell with just a description of the issue – Alon Eitan May 03 '17 at 14:07
  • There *IS* an explanation. – Kraken May 03 '17 at 14:08
  • Also read [this](https://docs.angularjs.org/error/$location/nobase) - Perhaps it something to do with the `` tag – Alon Eitan May 03 '17 at 14:08
  • I have added the working base tag. Everything works except when someone uses the old link with no path. ex: `domain.com/#/` – Kraken May 03 '17 at 14:13
  • Have you added an `otherwise` rule to `$routeProvider`? Try this [answer](http://stackoverflow.com/a/13833371/754119) – Alon Eitan May 03 '17 at 14:18
  • yes we have the otherwise rule – Kraken May 03 '17 at 14:21

0 Answers0