Re: Problem when using different response formats

26 views
Skip to first unread message
Message has been deleted

Jared Hanson

unread,
Nov 21, 2013, 11:08:36 AM11/21/13
to locomo...@googlegroups.com
Can you post a stack trace?


On Thu, Nov 21, 2013 at 7:10 AM, Daniel Heckrath <tcha...@gmail.com> wrote:
I tried to implement different response formats, according to the guide at http://locomotivejs.org/guide/formats/

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 locomotivejs...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Jared Hanson <http://jaredhanson.net/>

Daniel Heckrath

unread,
Nov 21, 2013, 4:11:12 PM11/21/13
to locomo...@googlegroups.com
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
Forward
0 new messages