template.js conditionals doesn't work

  • Hi,
    How can I use the conditionals if I want to compare the value.
    For example:

    <!-- IF (categories.parentCid == selectedCategory.cid) -->

    It does't work now.


  • Global Moderator

    @audreybest you can't. You'll have to use a helper or do that logic elsewhere. Maybe there's a category.isSelected boolean that already reflects if the category is the selected one?

  • @PitaJ Thanks for your reply. I wanted the case, if the subcategory is selected then parent category also selected.
    But now if the subcategories selected, then parent categories.isSelected = false.
    Maybe I should do a plugin? :muscle:

Log in to reply

Looks like your connection to NodeBB was lost, please wait while we try to reconnect.