this version will just return the result of getComments, which seem to be
an async function. so anything that might be returned from it will be not
the comments.
Am Mittwoch, 20. Februar 2013 19:00:45 UTC+1 schrieb Sergey Jamy:
>
> As i see you exports function "comments" which doesn't have self "return".
> Maybe this work:
>
> exports.comments = function (debate) {
> *return* debate.getComments(function(err,comments){
> console.log(comments.length);
> return comments.length;
> });
> };
>
> понедельник, 18 февраля 2013 г., 21:16:51 UTC+2 пользователь Eric Ponce
> написал:
>>
>> Hi guys!
>>
>> I'm working in a Geddy.JS application and I have one problem with one
>> function.
>>
>> In my view(in EJS) I have the next:
>>
>> *<%= h.comments(debate); %>*
>> *
>> *
>> My problem: When we go to the "comments" function, we have:
>> *
>> *
>> *
>> exports.comments = function (debate) {
>> debate.getComments(function(err,comments){
>> console.log(comments.length);
>> return comments.length;
>> });
>> };
>>
>> My app doesn't print anything, but CONSOLE.LOG prints all perfect.
>> How can I return the value and print it into the view?
>>
>> Thanks to all!!!!
>> *
>>
>
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.