devote / HTML5-History-API

HTML5 History API expansion for browsers not supporting pushState, replaceState
http://spb-piksel.ru
MIT License
1.02k stars 182 forks source link

Angularjs compilancy #74

Open souravchandra opened 9 years ago

souravchandra commented 9 years ago

I am using angularjs 1.2.26 and trying to use this library. Getting below error while trying to load the webpage in IE9:

Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: [["fn: function(){var oldUrl=$browser.url(),currentReplace=$location.$$replace;return changeCounter&&oldUrl==$location.absUrl()||(changeCounter++,$rootScope.$evalAsync(function(){$rootScope.$broadcast(\"$locationChangeStart\",$location.absUrl(),oldUrl).defaultPrevented?$location.$$parse(oldUrl):($browser.url($location.absUrl(),currentReplace),afterLocationChange(oldUrl))})),$location.$$replace=!1,changeCounter}; newVal: 7; oldVal: 6"],["fn: function(){var oldUrl=$browser.url(),currentReplace=$location.$$replace;return changeCounter&&oldUrl==$location.absUrl()||(changeCounter++,$rootScope.$evalAsync(function(){$rootScope.$broadcast(\"$locationChangeStart\",$location.absUrl(),oldUrl).defaultPrevented?$location.$$parse(oldUrl):($browser.url($location.absUrl(),currentReplace),afterLocationChange(oldUrl))})),$location.$$replace=!1,changeCounter}; newVal: 8; oldVal: 7"],["fn: function(){var oldUrl=$browser.url(),currentReplace=$location.$$replace;return changeCounter&&oldUrl==$location.absUrl()||(changeCounter++,$rootScope.$evalAsync(function(){$rootScope.$broadcast(\"$locationChangeStart\",$location.absUrl(),oldUrl).defaultPrevented?$location.$$parse(oldUrl):($browser.url($location.absUrl(),currentReplace),afterLocationChange(oldUrl))})),$location.$$replace=!1,changeCounter}; newVal: 9; oldVal: 8"],["fn: function(){var oldUrl=$browser.url(),currentReplace=$location.$$replace;return changeCounter&&oldUrl==$location.absUrl()||(changeCounter++,$rootScope.$evalAsync(function(){$rootScope.$broadcast(\"$locationChangeStart\",$location.absUrl(),oldUrl).defaultPrevented?$location.$$parse(oldUrl):($browser.url($location.absUrl(),currentReplace),afterLocationChange(oldUrl))})),$location.$$replace=!1,changeCounter}; newVal: 10; oldVal: 9"],["fn: function(){var oldUrl=$browser.url(),currentReplace=$location.$$replace;return changeCounter&&oldUrl==$location.absUrl()||(changeCounter++,$rootScope.$evalAsync(function(){$rootScope.$broadcast(\"$locationChangeStart\",$location.absUrl(),oldUrl).defaultPrevented?$location.$$parse(oldUrl):($browser.url($location.absUrl(),currentReplace),afterLocationChange(oldUrl))})),$location.$$replace=!1,changeCounter}; newVal: 11; oldVal: 10"]]
http://errors.angularjs.org/1.2.26/$rootScope/infdig?p0=10&p1=%5B%5B%22fn%3A%20function()%7Bvar%20oldUrl%3D%24browser.url()%2CcurrentReplace%3D%24location.%24%24replace%3Breturn%20changeCounter%26%26oldUrl%3D%3D%24location.absUrl()%7C%7C(changeCounter%2B%2B%2C%24rootScope.%24evalAsync(function()%7B%24rootScope.%24broadcast(%5C%22%24locationChangeStart%5C%22%2C%24location.absUrl()%2ColdUrl).defaultPrevented%3F%24location.%24%24parse(oldUrl)%3A(%24browser.url(%24location.absUrl()%2CcurrentReplace)%2CafterLocationChange(oldUrl))%7D))%2C%24location.%24%24replace%3D!1%2CchangeCounter%7D%3B%20newVal%3A%207%3B%20oldVal%3A%206%22%5D%2C%5B%22fn%3A%20function()%7Bvar%20oldUrl%3D%24browser.url()%2CcurrentReplace%3D%24location.%24%24replace%3Breturn%20changeCounter%26%26oldUrl%3D%3D%24location.absUrl()%7C%7C(changeCounter%2B%2B%2C%24rootScope.%24evalAsync(function()%7B%24rootScope.%24broadcast(%5C%22%24locationChangeStart%5C%22%2C%24location.absUrl()%2ColdUrl).defaultPrevented%3F%24location.%24%24parse(oldUrl)%3A(%24browser.url(%24location.absUrl()%2CcurrentReplace)%2CafterLocationChange(oldUrl))%7D))%2C%24location.%24%24replace%3D!1%2CchangeCounter%7D%3B%20newVal%3A%208%3B%20oldVal%3A%207%22%5D%2C%5B%22fn%3A%20function()%7Bvar%20oldUrl%3D%24browser.url()%2CcurrentReplace%3D%24location.%24%24replace%3Breturn%20changeCounter%26%26oldUrl%3D%3D%24location.absUrl()%7C%7C(changeCounter%2B%2B%2C%24rootScope.%24evalAsync(function()%7B%24rootScope.%24broadcast(%5C%22%24locationChangeStart%5C%22%2C%24location.absUrl()%2ColdUrl).defaultPrevented%3F%24location.%24%24parse(oldUrl)%3A(%24browser.url(%24location.absUrl()%2CcurrentReplace)%2CafterLocationChange(oldUrl))%7D))%2C%24location.%24%24replace%3D!1%2CchangeCounter%7D%3B%20newVal%3A%209%3B%20oldVal%3A%208%22%5D%2C%5B%22fn%3A%20function()%7Bvar%20oldUrl%3D%24browser.url()%2CcurrentReplace%3D%24location.%24%24replace%3Breturn%20changeCounter%26%26oldUrl%3D%3D%24location.absUrl()%7C%7C(changeCounter%2B%2B%2C%24rootScope.%24evalAsync(function()%7B%24rootScope.%24broadcast(%5C%22%24locationChangeStart%5C%22%2C%24location.absUrl()%2ColdUrl).defaultPrevented%3F%24location.%24%24parse(oldUrl)%3A(%24browser.url(%24location.absUrl()%2CcurrentReplace)%2CafterLocationChange(oldUrl))%7D))%2C%24location.%24%24replace%3D!1%2CchangeCounter%7D%3B%20newVal%3A%2010%3B%20oldVal%3A%209%22%5D%2C%5B%22fn%3A%20function()%7Bvar%20oldUrl%3D%24browser.url()%2CcurrentReplace%3D%24location.%24%24replace%3Breturn%20changeCounter%26%26oldUrl%3D%3D%24location.absUrl()%7C%7C(changeCounter%2B%2B%2C%24rootScope.%24evalAsync(function()%7B%24rootScope.%24broadcast(%5C%22%24locationChangeStart%5C%22%2C%24location.absUrl()%2ColdUrl).defaultPrevented%3F%24location.%24%24parse(oldUrl)%3A(%24browser.url(%24location.absUrl()%2CcurrentReplace)%2CafterLocationChange(oldUrl))%7D))%2C%24location.%24%24replace%3D!1%2CchangeCounter%7D%3B%20newVal%3A%2011%3B%20oldVal%3A%2010%22%5D%5D 
0liver commented 8 years ago

I haven't used this library but was just looking at it and its issues list where I found your issue report.

From reading the examples I conclude that this library won't work together with other libraries accessing the window.location object directly - you have to adapt your code to use a custom location instance that's instantiated via window.history.location || window.location.

It seems that you would have to change the source of Angular.js (or any other library, for that matter) to successfully use it with this one.