Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add promise-able search function (fixes #34, #35) #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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