koajs / ejs

a koa view render middleware, support all feature of ejs
MIT License
248 stars 57 forks source link

"locals" is not working #32

Closed neti-soft closed 7 years ago

neti-soft commented 7 years ago

I suppose I should be able to add global-type variables into locals and have access to them in each template, without passing them to render function. Can you confirm that, and if it is true fix that ASAP. Thanks)

example code: ejs(app, { root: path.join(__dirname, '/../view'), layout: 'layout', viewExt: 'html', cache: true, debug: false, locals: { test: "some global variable" } });

dscdtc commented 7 years ago

you can use this.state instead. I have trouble with this for long time.

Runrioter commented 7 years ago

Refer to ctx.state in koa.