Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"locals" is not working #32

Closed
neti-soft opened this issue Oct 17, 2016 · 2 comments
Closed

"locals" is not working #32

neti-soft opened this issue Oct 17, 2016 · 2 comments

Comments

@neti-soft
Copy link

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
Copy link

dscdtc commented May 17, 2017

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

@Runrioter
Copy link
Collaborator

Refer to ctx.state in koa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants