I have this code
App.Model('users').find(function (err, users) {
users.forEach(function(user) {
console.log(user.username);
});
});
//make usernames availible here.
This console logs the usernames.
Instead of just logging to the console I want make use of the data.
But How can do this?
Thanks
They will never be available where you want them. This isn’t how async/node.js programming works.
Possible:
Other possibilites: EventEmitter, flow controll libraries (e.g. async).
If you have written code in other languages before you need to be open to take a complete new approach how data will be handled.