lewis500
lewis500

Reputation: 99

AngularJS app freezes during query

I am running an Angular app with a Parse backend. When I make a query, the app freezes, even when the DOM doesn't depend on the data being grabbing at the time. That is why this answer was not so helpful. Is there any way to have the rest of the app run along while some request is in progress?

Below is the code that freezes everything until the request resolves. The Parse Javascript SDK comes with promises, which is what 'QS.errorQuery.find()` returns.

function get() {

        var queries = [
            QS.errorQuery.find(),
            QS.resLogQuery.find()
        ];

        return $q.all(queries)
            .then(function(res) {
                return {
                    errors: res[0],
                    logs: res[1]
                }; //end return
            }); //end return
    }; //end get

    get().then(function(res) {
        $scope.lineData = DP.bigLineParser(res.errors, res.logs);
    });

Upvotes: 4

Views: 491

Answers (1)

Victor Powell
Victor Powell

Reputation: 1848

The request is async so as the response is coming in, your UI wont freeze up. The long delay is probably happening when Parse gets its response from the server and parses it.

Upvotes: 2

Related Questions