I'm trying to get my expressJS-Model to my .jade-template, but the way I can access the Model with JS on the client-machine.
The idea is simple: I want to use the Model with Knockout - so I need to give the Model-Object as it is to the client.
If I do the obvious - var t = #{customer} - I ending up with the rendered output var t = [object Object] So how can I use the object on the client-side?
Thanks!
JSON.stringify the object on the server, and JSON.parse it on the client (will only work in IE >= 8, if you need to support older i3-browsers you could provide json-js from douglas crockford: https://github.com/douglascrockford/JSON-js