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

Commit

Permalink
fix(docs): migrate from $defer to $timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorMinar committed Jun 12, 2012
1 parent f16150d commit d9ff5fd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/src/templates/js/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ var docsApp = {
};


docsApp.directive.focused = function($defer) {
docsApp.directive.focused = function($timeout) {
return function(scope, element, attrs) {
element[0].focus();
element.bind('focus', function() {
scope.$apply(attrs.focused + '=true');
});
element.bind('blur', function() {
// have to use defer, so that we close the drop-down after the user clicks,
// have to use $timeout, so that we close the drop-down after the user clicks,
// otherwise when the user clicks we process the closing before we process the click.
$defer(attrs.focused + '=false');
$timeout(function() {
scope.$eval(attrs.focused + '=false');
});
});
scope.$eval(attrs.focused + '=true')
}
Expand Down

0 comments on commit d9ff5fd

Please sign in to comment.