angular-smarty icon indicating copy to clipboard operation
angular-smarty copied to clipboard

[$rootScope:inprog] $digest already in progress in blur function

Open ocombe opened this issue 11 years ago • 0 comments

In the demo when I focus the first input and type "a", the list appears, in use my keyboard keys (not the mouse) to select the first result, and press "enter". It throws an error "[$rootScope:inprog] $digest already in progress" here:

element.bind("blur", function(event) {
   if (scope.listItems.length) {
        event.preventDefault();
        scope.$apply(function() {
            scope.close();
        })
    }
});

It works fine with the mouse click, the error just happens when you use the keyboard arrows to select the result because the key events wrap everything is scope.$apply as well.

ocombe avatar Jun 18 '14 08:06 ocombe