Skip to content

Conversation

@ace-han
Copy link

@ace-han ace-han commented Nov 11, 2015

Based on #35 , make the return value from search function promise-able

@balicekt
Copy link

Hey, very nice!

I have just one question. I want to show loader before call my API but it doesn't work. My code looks like this:

            search: function (filterText) {
                $scope.showLoading = true;
                console.log('search');
                var deferred = $q.defer();
                $timeout(function (){
                    //$scope.searchLoading = false;
                        deferred.resolve(AdversaryLists.initSearchList(data.list)); 
                });
                return deferred.promise;
            },

in my console I can see 'search' is logged immediately but the property showLoading is true after deffered.resolve is called. Absolutely don't understand why :( Thanks for any help

@ace-han
Copy link
Author

ace-han commented Nov 19, 2015

@balicekt It's likely a typo. Just replace $scope.searchLoading = false; with $scope.showLoading = false;`

@balicekt
Copy link

@ace-han thank you for you answer. searchLoading = false is commented it not about it. It is about $scope.showLoading = true; because $scope.showLoading get true after deferred.resolve is called. It means is for nothing because I need to show spinner before it finish :( It means the loading spinner is never shown because it get false in the same time like get true (when I change scope.searchLoading to scope.showLoading and uncomment this line)

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

Successfully merging this pull request may close these issues.

2 participants