This is my first post so please forgive for any formatting issues.
I am new to Jade programming as well as a novice to JS. While working on Jade I was unable to run javascript within a jade block. Following is my Main.jade
extends layouts/standard
block pageContent
.container
h1= title
br
.row
#chart
svg(style='height: 80px;')
script
nv.addGraph(function() {
var chart = nv.models.bulletChart();
d3.select('#chart svg')
.datum(exampleData())
.transition().duration(1000)
.call(chart);
return chart;
});
function exampleData() {
return {"title":"Revenue","subtitle":"US$, in thousands","ranges":[150,225,300],"measures":[220],"markers":[250]};
block pageContent is a block within body of standard.jade
html(ng-app="webApp")
head
meta(charset="UTF-8")
meta(http-equiv="content-type", content="text/html")
meta(http-equiv="X-UA-Compatible", content="IE=edge")
meta(name="viewport", content="width=device-width, initial-scale=1.0")
link(rel="shortcut icon", type="image/x-icon", href="/images/favicon.ico")
link(rel="stylesheet", type="text/css", href="/stylesheets/libs/css/libs.css")
link(rel="stylesheet", type="text/css", href="/stylesheets/app/standard/app.css")
script(type="text/javascript", src="/javascript/libs/libs.js")
script(type="text/javascript", src="/javascript/app/app.js")
//if lt IE 8
script(type="text/javascript", src="/javascript/libs/respond/respond.js")
include ../directives/menus/logo
include ../directives/menus/main-nav-right
include ../directives/menus/main-search-form
body
block pageContent
But if I paste the javascript directly within the body of standard.jade; the script gets executed. nvd3.js and d3.js libraries required to run the script are included within /javascript/libs/libs.js present in head of standard.jade