Support for managing arrays in build and here() macros
{% if (data.tag == tag) %}
<a href="{{ here({ tag: { $pull: tag } }) }}" class="active">{{ tag }}</a>
{% else %}
<a href="{{ here({ tag: { $push: tag } }) }}">{{ tag }}</a>
{% endif %}
To match mongo this should be $addToSet rather than $push. The difference is that $addToSet does not create duplicates, which is the appropriate behavior when filtering.
Completed in #617
On Thu, Jul 21, 2016 at 10:53 AM, Kerry Gilbert [email protected] wrote:
{% if (data.tag == tag) %} {{ tag }} {% else %} {{ tag }} {% endif %}
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/punkave/apostrophe/issues/616, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB9fVw525OEAp1yGqUJRG277HyitvGIks5qX4fkgaJpZM4JR4ai .
*THOMAS BOUTELL, *SUPPORT LEAD P'UNK AVENUE | (215) 755-1330 | punkave.com