These different codes eventually produce different dialogs in my Glimmer app , see enclosed images:
(1)get imdbDirName() { let tmp = this.z.imdbDirName; return this.z.handsomize2sp(tmp); }(2)imdbDirName = () => { let tmp = this.z.imdbDirName; return this.z.handsomize2sp(tmp); }More: this.z.imbDirName is a getter in the “z“ service. What did I miss when expecting to see the same result? Note: Herethis.imdbDirName is defined.
What may be the reason for the different outcome?
#Getter vs. Arrow function
1 messages · Page 1 of 1 (latest)
what is your template code?
getters and functions have different template expectations
as in, functions are not automatically invoked unless you use invocation syntax
getters are "just properties" that have a body that's evaluated on each access
Some info about this from the template side of things here:
Thanks, I didn't notice the ( ) rule. Since it isn't always compulsory except seemingly always as argument in a {{t 'lookup' arg=(arrow)}} position 
right, the () for an invocation are only needed when you have no args -- for disambiguation
Though, I use like {{arrow}} without argument, successfully! Maybe just good luck? 😁
what is arrow?
An arrow function like in the example.
can you share code?
Yo find it at https://github.com/toreric/mish-dev/blob/master/mish-project/app/components/dialog-util.gjs
l. 59: the function, l. 331: use without ( ), l. 337: use with ( ).
why so many single letter variables?
L 331 is triple {{{ that's dangerous, and could open you up to a security vuln if any user or server input is rendered there
need to sanitize that before rendering
Is triple { dangerous without ( )? What is “need to sanitize that before rendering“? I really do care for safety. Advice me, please!