Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

humanReadableWatchExpression error on app load #94

Open
gary-b opened this issue Jun 21, 2015 · 2 comments
Open

humanReadableWatchExpression error on app load #94

gary-b opened this issue Jun 21, 2015 · 2 comments

Comments

@gary-b
Copy link
Contributor

gary-b commented Jun 21, 2015

When http://citiesinmotion.iese.edu/indicecim/ (Angular v1.2.16) is debugged with Batarang the console shows the following error message on load:

"TypeError: Cannot read property 'exp' of null
at humanReadableWatchExpression (chrome-extension://ighdmehidhipcmcojjgiloacoafjmpfk/dist/hint.js:2062)
at Scope.scopePrototype.$watch (chrome-extension://ighdmehidhipcmcojjgiloacoafjmpfk/dist/hint.js:1840)
at new paisesCtrl (/indicecim/scripts/views/app.js:180)
at invoke (/indicecim/scripts/vendor/angular/angular.js:3870)
at Object.instantiate (/indicecim/scripts/vendor/angular/angular.js:3881)
at /indicecim/scripts/vendor/angular/angular.js:7135
at chrome-extension://ighdmehidhipcmcojjgiloacoafjmpfk/dist/hint.js:1538
at /indicecim/scripts/vendor/angular/angular.js:6539
at forEach (/indicecim/scripts/vendor/angular/angular.js:331)
at nodeLinkFn (/indicecim/scripts/vendor/angular/angular.js:6526)"

The app then does not load properly.
(Result of some testing against apps on builtwith.angularjs.org)

@SomeKittens
Copy link
Member

Looks like we need a null check here: https://github.com/angular/angular-hint/blob/master/src/modules/scopes.js#L306

Can you find out exactly what watch is triggering the error?

gary-b added a commit to gary-b/angular-hint that referenced this issue Jul 16, 2015
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 angular#94
@gary-b
Copy link
Contributor Author

gary-b commented Jul 16, 2015

Hi SomeKittens

It was as simple as you presumed. The following code made its way into the referenced app, which ultimately was passing null to $scope.$watch.

      $scope.ngDatosPaises = null;
      $scope.guardar = function() {
        $scope.ngDatosPaises = datosPaises;
        $scope.$apply();
      };
      $scope.$watch($scope.ngDatosPaises, function() {
            // alert('hey, myVar has changed!');
            // $scope.$apply();
      });

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

No branches or pull requests

2 participants