vitalets / angular-xeditable

Edit in place for AngularJS
http://vitalets.github.io/angular-xeditable
MIT License
1.91k stars 403 forks source link

Error thrown when $scope.$$watchers is null. #498

Closed jerimiahbaldwin closed 8 years ago

jerimiahbaldwin commented 8 years ago

Under certain circumstances $scope.$$watchers may become null. The following segment in editable-element/controller.js is the cause. Suggest skipping this block if $scope.$$watchers is null.

      // Manually remove the watcher on 'has-error' to prevent a memory leak on it.
      for (var i = 0, len = $scope.$$watchers.length; i < len; i++) {
        if ($scope.$$watchers[i] !== undefined && $scope.$$watchers[i].last && $scope.$$watchers[i].last !== undefined &&
            typeof $scope.$$watchers[i].last === 'object' && "has-error" in $scope.$$watchers[i].last) {
          $scope.$$watchers.splice(i, 1);
          break;
        }
      }
angular.js:13642 TypeError: Cannot read property 'length' of null
    at EditableController.self.hide (xeditable.js:799)
    at xeditable.js:1323
    at Object.forEach (angular.js:322)
    at Object.$hide (xeditable.js:1322)
    at Object.$cancel (xeditable.js:1347)
    at xeditable.js:1187
    at Object.forEach (angular.js:322)
    at xeditable.js:1187
    at Scope.$eval (angular.js:17378)
    at Scope.$apply (angular.js:17478)
eugef commented 8 years ago

Fixed by #500

artemgrygor commented 8 years ago

@eugef any particular date when it will be published to NPM?

nickshiling commented 8 years ago

+1 to NPM publishing date question. Thanks

eugef commented 8 years ago

New release 0.3.0 is pushed

artemgrygor commented 8 years ago

@eugef fixed, thank you!

jerimiahbaldwin commented 8 years ago

Thank you!