We have answer of your question!

100% solved queries, no empty question

Question: Using Async inside another function [duplicate]


This question already has an answer here:

Question author Giuliog | Source



Using Node 6.0, in built Promises can be used.

convertProductfields: function (articlesFromAurelia){

    var allPromises = articlesFromAurelia
                      .map(post => new Promise((resolve, reject) => {
                               Categories.find({name: post.Categoria})
                                .then((category) => resolve(category))
                                .fail((error) => reject(error))
    return Promise.all(allPromises);

And to use the above function,

  .then(() =>{
       //handle success
  }).catch(() => {
       //handle error
Answer author Sainageswar-s

Tickanswer.com is providing the only single recommended solution of the question Using Async inside another function [duplicate] under the categories i.e javascript , node.js , asynchronous , sails.js , . Our team of experts filter the best solution for you.

Related Search Queries:

You may also add your answer

Thanks for contributing an answer to Tick Answer!