Re: Problem when using different response formats

Skip to first unread message
Message has been deleted

Jared Hanson

Nov 21, 2013, 11:08:36 AM11/21/13
Can you post a stack trace?

On Thu, Nov 21, 2013 at 7:10 AM, Daniel Heckrath <> wrote:
I tried to implement different response formats, according to the guide at

but when using this code:

var self = this; this.respond({ 'json': function() { self.res.json({ hello: 'world' }); }, default: function() { self.render(); } })

I get the error ReferenceError: self is not defined

Any ideas how to fix this problem=

You received this message because you are subscribed to the Google Groups "Locomotive" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit

Jared Hanson <>

Daniel Heckrath

Nov 21, 2013, 4:11:12 PM11/21/13
Ouch, I feel a little ashamed right now. Just noticed I missed the "var self = this;" part in my controller before calling respond.

Works as documented in the guide.
Reply all
Reply to author
0 new messages