Bushra Shahid
Bushra Shahid

Reputation: 781

Template render error: (unknown path) In NODE JS

I am developing a html page using node js.

My code for run app.js is

app.get('/',function(req,res){

     res.render('index',{"data":["name" , "ABC"] });

});

i am trying to show name on my HTML page like:

{% data.name %}

i am getting an error which is Template render error: (unknown path) and unknown block tag: data

I am using nunjucks as my engine.

Upvotes: 1

Views: 3319

Answers (1)

Nicolas C.
Nicolas C.

Reputation: 598

The syntax you are using {% ... %} is for template inheritance. So the template engine will try to find a template matching data.name, and as it is unable to find it, it throws an error.

To display a variable in your template, use: {{ data.name }}

Upvotes: 2

Related Questions