Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Cannot read property '$id' of undefined #7230

Closed
fitzchak opened this issue Apr 24, 2014 · 10 comments
Closed

Cannot read property '$id' of undefined #7230

fitzchak opened this issue Apr 24, 2014 · 10 comments

Comments

@pkozlowski-opensource
Copy link
Member

@fitzchak I'm afraid that it will have to be narrowed down further to make it actionable... The plunker in the referenced issue includes like 10 different scripts so it is not obvious at all what is going on.... Please try to remove all the non-essential bits to provide a minimal reproduce scenario.

@0x-r4bbit
Copy link
Contributor

So first, here's the plunk without the unused scripts: http://plnkr.co/edit/iF7wVs?p=preview

I'm not aware of any changes that happend in 1.3-beta in $interpolate service yet. Will investigate.

@caitp
Copy link
Contributor

caitp commented Apr 24, 2014

@PascalPrecht there were a few changes to $interpolate, and there is possibly one more scheduled for 1.3. These are all pretty recent, the plnkr works just fine with 1.3-beta-5

@0x-r4bbit
Copy link
Contributor

@caitp Yea, I just saw it in the changelog. And it seems that this issue was not even introduced by the breaking chance, but rather by this commit: 546cb42

@pkozlowski-opensource
Copy link
Member

The real exception is:

"TypeError: Cannot read property '$id' of undefined
    at interpolationFn (https://code.angularjs.org/1.3.0-beta.6/angular.js:8786:34)
    at Object.$translateInterpolator.interpolate (http://rawgit.com/angular-translate/bower-angular-translate/master/angular-translate.js:727:34)
    at $get.determineTranslationInstant (http://rawgit.com/angular-translate/bower-angular-translate/master/angular-translate.js:493:37)
    at Function.$get.$translate.instant (http://rawgit.com/angular-translate/bower-angular-translate/master/angular-translate.js:660:26)
    at Scope.<anonymous> (http://rawgit.com/angular-translate/bower-angular-translate/master/angular-translate.js:854:25)
    at fnInvoke (https://code.angularjs.org/1.3.0-beta.6/angular.js:10636:21)
    at OPERATORS.| (https://code.angularjs.org/1.3.0-beta.6/angular.js:10147:59)
    at Array.extend.constant (https://code.angularjs.org/1.3.0-beta.6/angular.js:10581:14)
    at Object.interpolationFn (https://code.angularjs.org/1.3.0-beta.6/angular.js:8812:44)
    at Scope.$RootScopeProvider.$get.Scope.$digest (https://code.angularjs.org/1.3.0-beta.6/angular.js:12551:40)"

@pkozlowski-opensource
Copy link
Member

Well, actually the culprit is here:
546cb42#diff-473570473a0495b94b1309cc45c7f2ffR202

And the reason it breaks it that undefined is passed as an argument to the function generated by $interpolate. This can be easily worked-around in the translate thing, but yes, this is kind of accidental-breaking-change on the angular side. A fix should be trivial.

@0x-r4bbit
Copy link
Contributor

@knalli
Copy link

knalli commented Apr 24, 2014

Please see my comment, don't see this here right.

angular-translate/angular-translate#521 (comment)

edit: And I'm also too late. Sigh.

caitp added a commit to caitp/angular.js that referenced this issue Apr 24, 2014
546cb42 introduced a regression, which would cause the function returned from
$interpolate to throw a ReferenceError if `context` is undefined. This change
prevents the error from being thrown.

Closes angular#7230
@caitp
Copy link
Contributor

caitp commented Apr 24, 2014

this basically fixes this afaik, I'll see if it gets an LGTM today. in the mean time, you might want to test it and see if it works for your use case

@0x-r4bbit
Copy link
Contributor

Thanks for you help @caitp :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants