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

Commit

Permalink
fix(autocomplete): reset loading state for non-q promises
Browse files Browse the repository at this point in the history
always reset loading state of autocomplete after handleResults() even if promise implementation does not support finally()
  • Loading branch information
winniehell committed Jan 27, 2016
1 parent 0918596 commit 3588c0a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/autocomplete/js/autocompleteController.js
Original file line number Diff line number Diff line change
Expand Up @@ -641,9 +641,15 @@ function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming,
$mdUtil.nextTick(function () {
if (items.success) items.success(handleResults);
if (items.then) items.then(handleResults);
if (items.finally) items.finally(function () {
setLoading(false);
});
if (items.finally) {
items.finally(function () {
setLoading(false);
});
} else if (items.then) {
items.then(function () {
setLoading(false);
});
}
},true, $scope);
}
function handleResults (matches) {
Expand Down

0 comments on commit 3588c0a

Please sign in to comment.