Pikto Embed

Tuesday, September 18, 2012

Jade template, how to pass concrete object to pages?


I have a jade template for my node.js project. I would like to send an object to the jade template and pass it to a function inside the page (to render something).
I am sure I send the right stuff from the server like this
res.render(__dirname + '/pages/viz.jade', {
    vizJson: newJson,
});
in the client I do something like this:
script
    sunburst(#{vizJson})
Thus, inside a script function, I want to call a function that creates my visualization with some json I created on the server side.
The problem is that when rendered I have something like sunburst([Object object]). I also tried to send the stringified version of the JSON but when I do JSON.parse(#{vizJson}) it complains likeUnexpected token &.
The json I send is always different and has different level of depths.
Does anyone knows what to do?

In the news



Welcome to Wikipedia

Craters of the Moon National Monument and Preserve is a U.S. National Monument and National Preserve in the Snake River Plain in central Idaho, at an average elevation of 5,900 feet (1,800 m) above sea level. The protected area features one of the best-preserved flood basaltareas in the continental United States. The Monument was established on May 2, 1924. InNovember 2000, a presidential proclamation by President Clinton greatly expanded the Monument area. The National Park Service portions of the expanded Monument were designated as a National Preserve in August 2002. The Monument and Preserve encompass three major lava fields and about 400 square miles (1,000 km2) of sagebrush steppe grasslands. All three lava fields lie along the Great Rift of Idaho, with some of the best examples of open rift cracks in the world, including the deepest known on Earth at 800 feet (240 m). (more...)

Friday, July 20, 2012