Skip to content
This repository was archived by the owner on May 28, 2019. It is now read-only.

scope.$apply fails in angular 1.3rc2 #95

Closed
alexanderchan opened this issue Sep 23, 2014 · 4 comments
Closed

scope.$apply fails in angular 1.3rc2 #95

alexanderchan opened this issue Sep 23, 2014 · 4 comments

Comments

@alexanderchan
Copy link
Contributor

Angular 1.3rc2 fails with $apply already in progress error.

      var _onSelect = opts.onSelect || angular.noop;
      opts.onSelect = function (value, picker) {
        scope.$apply(function() {
          showing = true;
          controller.$setViewValue(element.datepicker("getDate"));
          _onSelect(value, picker);
          element.blur();
        });
      };

Removing the $apply fixes part of this but then 'should handle unusual model values' tests fail. Any ideas on what can help resolve the apply problem and how best to correct the tests?

@wbeange
Copy link

wbeange commented Oct 27, 2014

+1

@wbeange
Copy link

wbeange commented Oct 27, 2014

Commenting out element.blur(); seems to fix things. Just testing more to make sure it works. What do you think?

@alexanderchan
Copy link
Contributor Author

@wbeange good find! perhaps it is related to angular/angular.js#8762, after doing the same there is just one test failing "uiDateFormat $formatting should handle unusual model" values.

I wonder if there is some other reason for the blur and what test there should be to test it.

@alexanderchan
Copy link
Contributor Author

@wbeange, thanks for digging out that blur I've removed it in #99 and fixed one more thing to resolve the "$formatting should handle unusual model" test case and at least it seems to pass all of the tests using angular 1.2.5 and 1.3.0.

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