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

ES2015 syntax results in TypeError: Cannot read property '1' of null #12424

Closed
OlsonDev opened this issue Jul 23, 2015 · 5 comments
Closed

ES2015 syntax results in TypeError: Cannot read property '1' of null #12424

OlsonDev opened this issue Jul 23, 2015 · 5 comments

Comments

@OlsonDev
Copy link

I put together this plunk to demonstrate the issue.

The issue itself (I'm reasonably sure) is the dependency annotator doesn't understand ES2015 syntax for shorthand method names even though the browser does (Chrome v43.0.2357.134 m, Windows 10).

The weird thing is it only matters for the controller key, best I can tell. If I use the same syntax for the link key, the TypeError doesn't happen and $scope is successfully injected.

Here's the full stack trace:

TypeError: Cannot read property '1' of null
    at Function.annotate (angular.js:3725)
    at Object.invoke (angular.js:4428)
    at $get.extend.instance (angular.js:8999)
    at nodeLinkFn (angular.js:8109)
    at compositeLinkFn (angular.js:7541)
    at compositeLinkFn (angular.js:7545)
    at compositeLinkFn (angular.js:7545)
    at publicLinkFn (angular.js:7416)
    at angular.js:1635
    at Scope.$get.Scope.$eval (angular.js:15846)
lgalfaso added a commit to lgalfaso/angular.js that referenced this issue Jul 23, 2015
@lgalfaso
Copy link
Contributor

#12425 should take care of this

@OlsonDev
Copy link
Author

Awesome. Thanks!

@jmls
Copy link

jmls commented Apr 22, 2016

I have this codepen which sometimes gives this error, using 1.5.5 of angular

http://codepen.io/anon/pen/ONwMGg?editors=1011

make a change (like a space) and the console sometimes shows the "Cannot read property '1' of null" error.

You may have to try a few times - sometimes the error happens all the time, and then sometimes you have to make several changes before you see it

image

as you can see, the lib is 1.5.5

@gkalpak
Copy link
Member

gkalpak commented Apr 22, 2016

This is because of some Chrome v50 weirdness. It's tracked in #14487.

@jmls
Copy link

jmls commented Apr 22, 2016

ah, thanks. I did indeed upgrade to v50 ... :(

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

No branches or pull requests

5 participants