javascript - AngularJS : Adding variable into a chain of promises -


i learning promises , struggling following.

three functions being run in case.

//returns search query in json format filtersearch()     // searches parse.com , returns array of values   .then(performsearch)    // passing array of values exercisesearch , value (term - string)   .then(function(result) {      exercisesearch(result, term);      })    // results search displayed in scope.    .then(function(exercises) {      $scope.allexercises = exercises;    }, function(error) {      console.log('error'); }); 

promise chain should have return object .then continue promise chain

//returns search query in json format filtersearch()     // searches parse.com , returns array of values   .then(performsearch)    //(term - string)   .then(function(result) {        return exercisesearch(result, term); //exercisesearch should return exercises fn      })    // results search displayed in scope.    .then(function(exercises) {      $scope.allexercises = exercises;      return exercises;   }, function(error) {      console.log('error'); }); 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -