ui-router: V1.1.0 - TypeError: Cannot read properties of undefined (reading 'inherit')

After updating to version 1.1.0 i’m not able to run my app anymore. I use AngularJS 1.8.3.

TypeError: Cannot read properties of undefined (reading 'inherit')
    at StateParams.$inherit (factory.js:63:9)
    at StateService.href (factory.js:63:9)
    at BaseUrlRule.handler (factory.js:63:9)
    at UrlService.sync (factory.js:63:9)
    at factory.js:63:9
    at factory.js:63:9
    at Array.forEach (<anonymous>)
    at factory.js:63:9
    at Scope.$broadcast (factory.js:63:9)
    at afterLocationChange (factory.js:63:9)
    at factory.js:63:9
    at Scope.$digest (factory.js:63:9)
    at Scope.$apply (factory.js:63:9)
    at bootstrapApply (factory.js:63:9)
    at Object.invoke (factory.js:63:9)
    at doBootstrap (factory.js:63:9)
(

I did not find any changelog and/or migration instructions. Any help is really appreciated.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 32 (15 by maintainers)

Most upvoted comments

The loop in stateParams.js kept adding the word ‘chunk’ in parentParamsKeys. (node_modules/@uirouter/core/lib-esm/params/stateParams.js)

I don’t know what causes that, but I changed the loop from

for (let j in parentParamsKeys) {
    if (parentParams[parentParamsKeys[j]].inherit == false || inheritList.indexOf(parentParamsKeys[j]) >= 0)
        continue;
    inheritList.push(parentParamsKeys[j]);
    inherited[parentParamsKeys[j]] = this[parentParamsKeys[j]];
}

to

parentParamsKeys.forEach(j => {
    if (parentParams[j].inherit == false || inheritList.indexOf(j) >= 0)
        return;
    inheritList.push(parentParamsKeys[j]);
    inherited[parentParamsKeys[j]] = this[parentParamsKeys[j]];
});

now it works.

Well, I think your case is still supported so I’ll add a fix for your case!

You just showed me the issue 😄. The value of the param is null which is not an object 😄