Created
April 11, 2016 13:59
-
-
Save kenelliott/5d2a4dd445f7459b7ff3afe072d51a5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// don't make functions within a loop | |
model.get('things').then(things => { | |
things.forEach(thing => { | |
thing.get('attachment').then(attachment => { | |
thing.set('foo', true); | |
attachment.set('bar', true); | |
}); | |
}) | |
}); | |
// attempted solution | |
model.get('things').then(things => { | |
things.forEach(thing => { | |
// how do I pass attachment without making a function? | |
thing.get('attachment').then(attachmentFunction(thing)); | |
}) | |
}); | |
var attachmentFunction = function(attachment, thing) { | |
thing.set('foo', true); | |
attachment.set('bar', true); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment