-
Notifications
You must be signed in to change notification settings - Fork 72
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
Checking optional parameter with ternary expression #29
Comments
An example for if ... else and a ternary expression would be appreciated. Having trouble to get any of them to work.
partial.ejs:
Results in this:
It doesn't matter if supply the parameter Just this:
And passing the parameter
|
should look like
If you're using the version installed by default from npm, the correct docs are here. You can install the actual latest version, which uses this version of ejs with It's pretty confusing at the moment, took me a while to figure out. Edit: Sorry, I forgot to answer the original question. I don't know if there's any way to keep it from spitting out an error when ejs tries to resolve
|
Thank you! I upgraded to 2.2.0 and it also allows include paths to be relative to the template. Had some problems in mocha when they were relative to where webpack was run. |
Hi,
To check if a parameter is optional or not, this is the only way I've gotten it to work.
<%= typeof optional!='undefined' ? optional : '' %>
Shouldn't this work as well?
<%= optional ? optional : '' %>
Is there any other way to do this?
The text was updated successfully, but these errors were encountered: