angular-hint icon indicating copy to clipboard operation
angular-hint copied to clipboard

humanReadableWatchExpression error on app load

Open gary-b opened this issue 10 years ago • 2 comments

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)

gary-b avatar Jun 21 '15 01:06 gary-b

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?

SomeKittens avatar Jun 28 '15 18:06 SomeKittens

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();
      });

gary-b avatar Jul 16 '15 22:07 gary-b