I am learning promises and am struggling with the following.
Three functions are being run in this case.
//returns an search query in JSON format
filterSearch()
// searches Parse.com and returns an array of values
.then(performSearch)
// I am passing the array of values to exerciseSearch and a another value (term - string)
.then(function(result) {
exerciseSearch(result, term);
})
// The results from the search is displayed in scope.
.then(function(exercises) {
$scope.allExercises = exercises;
}, function(error) {
console.log('error');
});
return exerciseSearch(result, term)