Reputation: 87
So I needed to add some more information for my users and as a test I'd try to pass a simple string to my view, you know just to get it going. My app worked before I added this change.
Before I sent this to my ejs template:
if (errorMessage) {
res.render("index", {weather: null, error: errorMessage})
} else {
res.render("index",{weather:weatherText, error:null});
}
My weather is simply a string containing information but nothing but a string. I then tried to add this little string to my rendering:
res.render("index",{weather:weatherText, error:null, testStr: "Hello"});
Calling it:
<%= testStr %>
but my testStr is undefined. Anyone has an idea what causes this, to me it's the exact same as the weather which works wonder.
Upvotes: 0
Views: 29
Reputation: 87
Found out what caused it. Wasn't using nodemon, a server restart solved it.
Upvotes: 1