Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$apply already in progress #42

Open
xduseko opened this issue Feb 5, 2016 · 2 comments
Open

$apply already in progress #42

xduseko opened this issue Feb 5, 2016 · 2 comments

Comments

@xduseko
Copy link

xduseko commented Feb 5, 2016

This error occurs when angularPlayer service is used and soundManager directive exists on the page.

Example:

  1. Call angularPlayer.addTrack inside ng-click event handler.
    Note: Every ng-something handler is executed in $apply phase by AngularJS.
  2. Method angularPlayer.addTrack broadcasts player:playlist event.
  3. SoundManager directive catches the event.
scope.$on('player:playlist', function(event, data) {
    scope.$apply(function() {
        scope.playlist = data;
    });
});

Note: We are still in $apply phase, because angular events are handled synchronously.
4. Error occurs

Error: [$rootScope:inprog] $apply already in progress

The plunker is here http://plnkr.co/edit/77Fy0oJpvRrPrmG1YRbR?p=preview.

xduseko pushed a commit to winsite/angular-soundmanager2 that referenced this issue Feb 5, 2016
xduseko pushed a commit to winsite/angular-soundmanager2 that referenced this issue Feb 5, 2016
@xduseko
Copy link
Author

xduseko commented Feb 5, 2016

Pull request #43

@elprup
Copy link

elprup commented Mar 20, 2016

I have the same problem, solved by xduseko's fix, thanks.

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

No branches or pull requests

2 participants