Thanks for this–it helps clarify a lot.
Haven’t quite gotten it to work yet–in part bc I’m not finding examples out there of using computed properties to do this kind of operation.
In my case, in my plugin, I am making the change in the group index template. So in the file: plugin/assets/javascripts/discourse/groups/index.hbs (I just put the entire groups index code there and add changes on top of it.)
Do you mean that the computed property js would go in a file I create that is: plugin/assets/javascripts/discourse/groups/index.js? Or can I just put that code in an initializer?
This is my best attempt to implement what you are talking about–is this what you had in mind:
js:
export default Component.extend({
@discourseComputed("group.name", "Amazing_Name")
property(group.name, Amazing_Name) {
return group.name === Amazing_Name
}
})
hbs:
{{#if property}}
<div>Yep There is a Match!</div>
{{/if}}
Or did you mean that I should literally enter general values like “string1” and “string2” in @discourseComputed, and then change the template to {{#if property group.name "Amazing_Name"}} ? (only that way could I account for each value being dynamic in the template.)
Haven’t gotten either approach to quite work yet.
Thank you for your help.