alphagov / govuk_frontend_toolkit

❗️GOV.UK Frontend Toolkit is deprecated, and will only receive major bug fixes and security patches.
MIT License
403 stars 107 forks source link

Question about conditional logic on {{ data[] }} #437

Closed deckchairuk closed 6 years ago

deckchairuk commented 6 years ago

Hello, sorry if this is the wrong place for this but I am unable to join the Slack channel.

I need to run a conditional on some data but I'm not sure how using the templating language. Could anyone help?

deckchairuk commented 6 years ago

Solved using nunjucks documentation (had to work it out myself partly.

For anyone else that comes to this looking for help you can run conditionals on the data tag like so:

{{ "Yes" if data['dataName']}}

joelanman commented 6 years ago

thanks for updating! For future reference, the prototype kit repo is over here:

https://github.com/alphagov/govuk_prototype_kit