0

Hi want to perform the applyParameters function after a 5 second delay. However my current syntax isn't doing it.

Any idea about how to do this?

//Add and update categories
                var categories = homeData['categories'];
                for(var catIndex in categories){
                    var category = categories[catIndex];
                    $scope.addCategory(category);
                }

                $scope.search.text = homeData['keyword'];

                //Pick first company in the results
                $scope.updateSelectedCompany( response.data[0] );

                //populate parameters if passed in after 1 second delay
                $timeout($scope.applyParameters($routeParams.param1), 5000);

1 Answer 1

2

Wrap your code in a function:

$timeout(function(){
     $scope.applyParameters($routeParams.param1);
}, 5000);

Currently $scope.applyParameters($routeParams.param1) is evaluated and Angular tries to call the return value of applyParameters as a function.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.