I have a form helper mixin that I'm passing in a variable to:
mixin form-error(error)
if (typeof errors !== 'undefined' && errors.#{error})
.alert.alert-error.form-error
=errors.#{error}.msg
Calling it and passing a string to it:
mixin form_error('name')
but am getting: 500 SyntaxError: Unexpected token ILLEGAL
Essentially I took everything out and it was upset over errors.#{error}
and =errors.#{error}.msg
So I can't use #{error}
after a .
?
Do you mean this?
mixin form-error(error)
if (typeof errors !== 'undefined' && errors[error])
.alert.alert-error.form-error
=errors[error].msg
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.