angular / angular-hint

run-time hinting for AngularJS applications
363 stars 45 forks source link

fix($watch): don't break #117

Closed gkalpak closed 8 years ago

gkalpak commented 8 years ago

Due to a change introduced in AngularJS v1.5.0 (https://github.com/angular/angular.js/commit/1c6edd416b4baad0c8b01148f429eb78e0ad7eaa), the watchAction callback is called without a context (i.e. this === undefined). This caused an error while trying to access this.$id.

Fixes angular/batarang#285

gkalpak commented 8 years ago

FWIW, I don't think it worked as expected before, because the context of the wathAction callback was not the scope, but an object representing the watcher. So, I think this.$id was always undefined, it just didn't threw, because this was defined.

Not sure if this fix will also fix some other problem related to the id property being undefined previously.

SomeKittens commented 8 years ago

LGTM. Thanks for taking the time to fix this right!

SomeKittens commented 8 years ago

Oh cripes, realized I approved this and never pulled it in. Sorry! Doing that now...

SomeKittens commented 8 years ago

Landed in https://github.com/angular/angular-hint/commit/db662f5020065e1dcf457a195806369ebd698d6c

gkalpak commented 8 years ago

@SomeKittens, thx for merging :+1:

Since I'm not familiar with batarang's build/release process: Now that this has been fixed in ngHint, how/when is the fix pulled into batarang ?

SomeKittens commented 8 years ago

Only @btford or @erwinmombay can pull a release, I mentioned this in Slack

gkalpak commented 8 years ago

Has this been released yet ?

SomeKittens commented 8 years ago

No, I don't work for Google so I don't have the ability to publish a new release. Only @btford and @erwinmombay can, so poke 'em if you can.

erwinmombay commented 8 years ago

woot, ill ping brian if we can do a release. i dont think i have access to the a release for the extension.

SomeKittens commented 8 years ago

@erwinmombay I can cut a npm release, what's your username there? I'll add you to that project.

SomeKittens commented 8 years ago

Alright, version 0.3.8 is published to npm.