title: ejs - template variable is not defined
body: <p>i'm a web noob and I couldn't find an answer that solved my case:</p>
  
  <p>I'm trying to pass on a variable called catURL to my html file but when I try to render it, it fails.</p>
  
  <p>This is how I pass the variable:</p>
  
  <pre><code>res.render('index', {catURL: url, error: null});
  </code></pre>
  
  <p>This is where I try to show it in my html:</p>
  
  <pre><code>&lt;div id="Wax on" class="tabcontent"&gt;
    &lt;h3&gt;Wax on&lt;/h3&gt;
    &lt;p&gt;Dont forget to wax off!!!&lt;/p&gt;
    &lt;% if(catURL !== null){ %&gt;
      &lt;img src="&lt;%= catURL %&gt;" /&gt;
    &lt;% } %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is the error msg that I get:</p>
  
  <pre><code>ReferenceError: /Users/nimrodshai/Documents/Projects/WeatherJS/views/index.ejs:21
      19|       &lt;h3&gt;Wax on&lt;/h3&gt;
      20|       &lt;p&gt;Dont forget to wax off!!!&lt;/p&gt;
   &gt;&gt; 21|       &lt;% if(catURL !== null){ %&gt;
      22|         &lt;img src="&lt;%= catURL %&gt;" /&gt;
      23|       &lt;% } %&gt;
      24|     &lt;/div&gt;
  
  catURL is not defined
      at eval (eval at compile (/Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/ejs/lib/ejs.js:618:12), &lt;anonymous&gt;:11:8)
      at returnedFn (/Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/ejs/lib/ejs.js:653:17)
      at tryHandleCache (/Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/ejs/lib/ejs.js:251:36)
      at View.exports.renderFile [as engine] (/Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/ejs/lib/ejs.js:482:10)
      at View.render (/Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/express/lib/view.js:135:8)
      at tryRender (/Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/express/lib/application.js:640:10)
      at Function.render (/Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/express/lib/application.js:592:3)
      at ServerResponse.render (/Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/express/lib/response.js:1008:7)
      at /Users/nimrodshai/Documents/Projects/WeatherJS/server.js:14:6
      at Layer.handle [as handle_request] (/Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/express/lib/router/layer.js:95:5)
      at next (/Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/express/lib/router/route.js:137:13)
      at Route.dispatch (/Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/express/lib/router/route.js:112:3)
      at Layer.handle [as handle_request] (/Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/express/lib/router/layer.js:95:5)
      at /Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/express/lib/router/index.js:281:22
      at Function.process_params (/Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/express/lib/router/index.js:335:12)
      at next (/Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/express/lib/router/index.js:275:10)
      at urlencodedParser (/Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/body-parser/lib/types/urlencoded.js:91:7)
      at Layer.handle [as handle_request] (/Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/express/lib/router/layer.js:95:5)
      at trim_prefix (/Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/express/lib/router/index.js:317:13)
      at /Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/express/lib/router/index.js:284:7
      at Function.process_params (/Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/express/lib/router/index.js:335:12)
      at next (/Users/nimrodshai/Documents/Projects/WeatherJS/node_modules/express/lib/router/index.js:275:10)
  </code></pre>
  
  <p>Appreciate your help</p>