You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just thinking out loud here. Right now, from what I understand, *-param attributes are static. Would there be any value in allowing them to reference a controller-scoped value? I'm thinking specifically here in terms of cross-controller communication. Perhaps we could use the # to denote a controller-scoped value, much like we do with the data-action syntax. Maybe something like:
data-foo-id-param="bar#id" -> Passes bar.id into foo method (in event.params).
data-foo-bar-param="bar#" -> Passes bar into foo method (in event.params).
If I can argue against myself for a moment, this is a terrible idea because it seeks to make the Controller instance the source of truth for a value when the DOM should be the source of truth for a value (if I understand the Hotwire mentality correctly).
Also, at least in this case, the value of .id could presumably be made available via server-side rendering of the template:
data-foo-id-param="{{ id }}"
... so, it shouldn't need to use the controller reference.
Anyway, just thinking out loud, and trying to evolve my Angular brain into a Hotwire brain (slowly).
This discussion was converted from issue #667 on March 04, 2025 06:44.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Just thinking out loud here. Right now, from what I understand,
*-paramattributes are static. Would there be any value in allowing them to reference a controller-scoped value? I'm thinking specifically here in terms of cross-controller communication. Perhaps we could use the#to denote a controller-scoped value, much like we do with thedata-actionsyntax. Maybe something like:data-foo-id-param="bar#id"-> Passesbar.idintofoomethod (inevent.params).data-foo-bar-param="bar#"-> Passesbarintofoomethod (inevent.params).If I can argue against myself for a moment, this is a terrible idea because it seeks to make the Controller instance the source of truth for a value when the DOM should be the source of truth for a value (if I understand the Hotwire mentality correctly).
Also, at least in this case, the value of
.idcould presumably be made available via server-side rendering of the template:data-foo-id-param="{{ id }}"... so, it shouldn't need to use the controller reference.
Anyway, just thinking out loud, and trying to evolve my Angular brain into a Hotwire brain (slowly).
Beta Was this translation helpful? Give feedback.
All reactions