Question

How do I prevent Cyclone from converting the code? I mean, I want this line to be transfered as such to the browser so that Handlebar.js can use this as a template.

<script type="text/x-handlebars">
    My firstName is {{Employee.firstName}}
</script>

{{Employee.firstName}} should be evaluated on the client-side. But my cyclone server tries to evaluate it on server-side and throws up an error. How do I prevent this from happening and sending it to the browser as such? The code given above is what I want in the browser-side.

Was it helpful?

Solution 2

Well, I found the answer myself. looks like, I have to add an exclamation mark (!) as shown below from preventing cyclone evaluating the template. Like this,

<script type="text/x-handlebars">
    My firstName is {{!Employee.firstName}}
</script>

There it is.

OTHER TIPS

You should also consider not mixing your Handlebars and your Tornado/Cyclone templates in the same file. You could also just read the file, and return it and let the client do all of the rendering.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top