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

Broken with Angular 1.3.0-beta-16 #124

Closed
AaronJessen opened this issue Jul 25, 2014 · 4 comments · Fixed by #137
Closed

Broken with Angular 1.3.0-beta-16 #124

AaronJessen opened this issue Jul 25, 2014 · 4 comments · Fixed by #137
Milestone

Comments

@AaronJessen
Copy link

I'm attempting to implement the ui-select with Angular 1.3.0-beta-16, and I'm receiving the following error:

https://docs.angularjs.org/error/$rootScope/inprog?p0=$apply

Apparently, manually calling $apply is no longer allowed? I know that this is a bleeding edge version, so nothing is guaranteed to work. However, I figured I'd let you know, since it may, indeed, be a permanent change which will affect your code.

P.S. The issue is with angular-santize.js, as switching out angular.js, alone, does not cause the error.

@dimirc dimirc added this to the 0.6.0 milestone Jul 29, 2014
@ericclemmons
Copy link

I'm getting the same issue.

// app.js
$sce.enabled(false);

// view.html
            <div ui-select ng-model="$parent.state">
              <div ui-select-match placeholder="Choose Your State">
                {{ state.name }}
              </div>
              <div ui-select-choices repeat="state in states | filter:{ name: $select.search }">
                <span ng-bind-html="state.name | highlight:$select.search"></span>
              </div>
            </div>

@dimirc
Copy link
Contributor

dimirc commented Aug 2, 2014

Problem caused by this commit in angular code.

I already also send them a comment with a proposal on how to prevent this

@guzart
Copy link

guzart commented Aug 2, 2014

I think this error comes from line 244 when the close method, which is executed inside the angular realm (a $digest cycle), calls a DOM method (focus()). Any other directive that binds to the focus DOM event and attempts to execute an expression in the angular realm using $apply will cause an $apply already in progress exception.

This looks similar to the issue 750 on angular-strap.

@petebacondarwin
Copy link
Member

You are correct @guzart. The solution is to call the focus() method "outside of Angular". You can do this using

setTimeout(function() { ctrl.focusser[0].focus(); }, 0);

or

$timeout(function() { ctrl.focusser[0].focus(); }, 0, false);

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

Successfully merging a pull request may close this issue.

5 participants