Issue with StateParams
uirouter/core v6.1.0. I'm facing this issue:
modules.js?hash=5f47…9fe47f2ba01d:280243 TypeError: Cannot read properties of undefined (reading 'inherit')
at StateParams.$inherit (modules.js?hash=5f47…47f2ba01d:309683:55)
at StateService.href (modules.js?hash=5f47…47f2ba01d:311445:34)
at BaseUrlRule.handler (modules.js?hash=5f47…47f2ba01d:313502:24)
at UrlService.sync (modules.js?hash=5f47…47f2ba01d:313756:39)
at modules.js?hash=5f47…7f2ba01d:313788:104
at modules.js?hash=5f47…7f2ba01d:304237:125
at Array.forEach (<anonymous>)
at modules.js?hash=5f47…47f2ba01d:304237:94
at Scope.$broadcast (modules.js?hash=5f47…47f2ba01d:284396:28)
at afterLocationChange (modules.js?hash=5f47…47f2ba01d:280073:18)
Thanx for your help, really appreciated!
I am seeing the same thing in the StateParams.prototype.$inherit() function.
As the image below shows, the for on line 24 has iterated past a valid "#" parameters and then carries on to a key named "objectPresent", which is a property of the prototype. This return undefined and then the error when attempting to get the "inherit" property.
I'm trying to upgrade my hybrid application to Angular 16. Could this possibly be a version incmpatibility? This is what I have: "@uirouter/angular": "^12.0.0", "@uirouter/angular-hybrid": "^16.0.0", "@uirouter/angularjs": "^1.1.0", "@uirouter/core": "^6.1.0", "@uirouter/rx": "^1.0.0", "@uirouter/visualizer": "^7.2.1", "angular-ui-router": "^1.0.29", "angular": "~1.5.0",
Any help/advice gratefully received
Thanks
I believe this is the same as https://github.com/angular-ui/ui-router/issues/3851 . You probably have custom prototype methods on the array that for some reason have been defined as enumerable. You should use Object.defineProperty (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty) instead
@wawyed Thank you! It's some pretty old code that I'm returning to and I never dreamed that I'd done this to the prototype! I've been puzzling over this for hours and I had no recollection of it being right there in my own code - so thanks very much for the tip!
This should be now fixed in 6.1.1