craftpip/angular-confirm

Some scope watch may caused angular dirty check goes wrong.

Woodu opened this issue · 3 comments

Woodu commented

In Line 481:

 _bindEvents: function () {
                    var that = this;
                    this._scope.$watch('[ngc.alignMiddle, ngc.offsetTop, ngc.offsetBottom]', function () {
                        that.setDialogCenter('bindEvents');
                    });

due to angular offical document (https://docs.angularjs.org/error/$rootScope/infdig ),those code may caused dirty check error.
I modified to this.

_bindEvents: function () {
          var that = this;
          var boxSets = [this._scope.ngc.alignMiddle, this._scope.ngc.offsetTop, this._scope.ngc.offsetBottom];
          this._scope.$watch(boxSets, function () {
            that.setDialogCenter('bindEvents');
          });

Thanks for this, will make the changes soon

same error here, woodu's solution works

from v1.1.0
ngConfirm wont use scope for internal operations,
this caused problems in memory leaks and circular references.

previous code is completely removed.