Ember component issue i am facing

Hello ,

I have a component {{table-royal data=data}} data contains an json array {[“name”:“king”],[“name”:“queen”]} in controller. now inside this component there is table and each row the table contains a dropdown of year having [“1910,1920,…”]… i have a action defined on the click of the dropdown which gives me the selection , then set “isFilter” true property in that data array eg. if king is selected {[“name”:“king”, “isFilter”:“true”],[“name”:“queen”]}

then in hbs of component i have

{{#if data.FilterCriteria equals true}}//equals is a helper



{{ dropdown}}

but the component always show dropdown

even i have console.log the data …it show the is Filter property set

I don’t know if I’m following the problem exactly, but you should be able to use the default behavior of the if helper:

{{#if data.FilterCriteria}}
<h1> Something if true </h1>

Most template helpers for comparisons follow similar truthiness / falsiness rules like in JavaScript.

1 Like

This won’t work because helpers aren’t infix. If you have an equals helper it would need to be called like:

{{#if (equals data.FilterCriteria true)}}

That said, there’s no reason to use a helper in your example for the reason @efx said. It’s just

{{#if data.FilterCriteria}}