Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

ngClick + ngFocus = $rootScope:inprog error #5945

Closed
eyelidlessness opened this issue Jan 23, 2014 · 0 comments
Closed

ngClick + ngFocus = $rootScope:inprog error #5945

eyelidlessness opened this issue Jan 23, 2014 · 0 comments

Comments

@eyelidlessness
Copy link

Steps to reproduce:

  1. Set up a directive with:
    • an element with ng-click
    • an input with ng-focus
  2. Inside the ng-click handler, call input.focus()

Expected result:

Input will focus, and ng-focus handler will be called.

Observed result:

Input focuses, but $rootScope:inprog error thrown. Error cannot be caught. ng-focus handler never called.

Example code

http://jsfiddle.net/MVxqj/2/

Narretz added a commit to Narretz/angular.js that referenced this issue Mar 29, 2014
Narretz added a commit to Narretz/angular.js that referenced this issue Mar 29, 2014
Narretz added a commit to Narretz/angular.js that referenced this issue Mar 29, 2014
Narretz added a commit to Narretz/angular.js that referenced this issue Mar 29, 2014
Narretz added a commit to Narretz/angular.js that referenced this issue Mar 29, 2014
Narretz added a commit to Narretz/angular.js that referenced this issue Jul 15, 2014
@Narretz Narretz added this to the Backlog milestone Jul 18, 2014
@btford btford removed the gh: issue label Aug 20, 2014
tbosch added a commit to tbosch/angular.js that referenced this issue Aug 27, 2014
…$evalAsync`

BREAKING CHANGE:
The `blur` and `focus` event fire synchronously, also during DOM operations
that add/remove elements. This lead to errors as the Angular model was not
in a consistent state.

This change executes the expression of those events now asynchronously.

Related to angular#5945
Fixes angular#4979
tbosch added a commit to tbosch/angular.js that referenced this issue Aug 27, 2014
…$evalAsync`

BREAKING CHANGE:
The `blur` and `focus` event fire synchronously, also during DOM operations
that add/remove elements. This lead to errors as the Angular model was not
in a consistent state.

This change executes the expression of those events now asynchronously.

Fixes angular#4979
Fixes angular#5945
Closes angular#8803
Closes angular#6910
Closes angular#5402
tbosch added a commit to tbosch/angular.js that referenced this issue Aug 28, 2014
…$evalAsync`

BREAKING CHANGE:
The `blur` and `focus` event fire synchronously, also during DOM operations
that remove elements. This lead to errors as the Angular model was not
in a consistent state. See this [fiddle](http://jsfiddle.net/fq1dq5yb/) for a demo.

This change executes the expression of those events using
`scope.$evalAsync` if an `$apply` is in progress, otherwise
keeps the old behavior.

Fixes angular#4979
Fixes angular#5945
Closes angular#8803
Closes angular#6910
Closes angular#5402
tbosch added a commit to tbosch/angular.js that referenced this issue Aug 28, 2014
…$evalAsync`

BREAKING CHANGE:
The `blur` and `focus` event fire synchronously, also during DOM operations
that remove elements. This lead to errors as the Angular model was not
in a consistent state. See this [fiddle](http://jsfiddle.net/fq1dq5yb/) for a demo.

This change executes the expression of those events using
`scope.$evalAsync` if an `$apply` is in progress, otherwise
keeps the old behavior.

Fixes angular#4979
Fixes angular#5945
Closes angular#8803
Closes angular#6910
Closes angular#5402
@tbosch tbosch closed this as completed in 719c747 Aug 28, 2014
tbosch added a commit that referenced this issue Aug 29, 2014
…$evalAsync`

BREAKING CHANGE:
The `blur` and `focus` event fire synchronously, also during DOM operations
that remove elements. This lead to errors as the Angular model was not
in a consistent state. See this [fiddle](http://jsfiddle.net/fq1dq5yb/) for a demo.

This change executes the expression of those events using
`scope.$evalAsync` if an `$apply` is in progress, otherwise
keeps the old behavior.

Fixes #4979
Fixes #5945
Closes #8803
Closes #6910
Closes #5402
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants