Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdded local variables on render #4429
Comments
|
There is nothing in express that is adding something called |
|
That was a fast reply and an unexpected answer. Here is the code: groupby(Function)
Route
View(EJS):
As far as the Data, this is how it looks like after each step: From DB
After groupBy:
In the FE:
|
|
BTW if i stringify the object on render I get the following error: So i'm thinking render adds that property on any object it sends. Update: Very strange but somehow related to passing an object directly to render rather than inside an object. |
Hi,
I'm using express and ejs.
I passed an object to res.render then called a for in loop on it on the template but when it's printed it has _locals inside too.
Everywhere i checked inside the object it wasn't there, yet on output to the end user it has this extra variable.
I didn't find anything directly on this but a couple of other issues kinda point out that local variables are automatically included in the response to the view and yet i have never encountered this situation before.
I had to do a hacky solution for this with an if statement checking for this and ignoring it.
Any other comments on this?