angular / angular-hint

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

fix(scopes) handle watches on null expression #103

Closed gary-b closed 9 years ago

gary-b commented 9 years ago

Passing null as first parameter to the $scope.$watch function caused a null reference exception within hint.js that interferes with the loading of the users app. Adding a null check to resolve this issue.

Fixes issue #94

SomeKittens commented 9 years ago

Just the equals thing, otherwise looks great! Thanks again

gary-b commented 9 years ago

Hi SomeKittens

The intention here is to catch undefined as well as null, as the same bug will occur with undefined. Perhaps i am wrong to always be returning null, might be best to return fn, so it correctly reports what the user passed in - ill change that sure and add a test for the undefined scenario. Would you like me to use strict equals to check for both null and undefined as well, or will loose equals be OK now?

SomeKittens commented 9 years ago

Just strictly check for both fn === null || fn === undefined

btford commented 9 years ago

I actually prefer @gary-b's way.