Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. _.each(data.recipe, function(recipeItem) {
  2. var recipeMap = that.get('recipeMap');
  3. recipeMap[recipeItem.id] = { id: recipeItem.id, quantity: recipeItem.quantity };
  4. });
  5. console.log(that.get('recipeMap')); //not ready yet.
  6.  
  7. async.each(data.recipe, function(recipeItem, callback) {
  8. var recipeMap = that.get('recipeMap');
  9. recipeMap[recipeItem.id] = { id: recipeItem.id, quantity: recipeItem.quantity };
  10. callback(); // show that no errors happened
  11. }, function(err) {
  12. if(err) {
  13. console.log("There was an error" + err);
  14. } else {
  15. console.log("Loop is done");
  16. }
  17. });
  18.  
  19. _.each(collection, function(model) {
  20. if(model.collection.indexOf(model) + 1 == collection.length) {
  21. // Callback goes here
  22. }
  23. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement