pfaffman
(Jay Pfaffman)
February 15, 2024, 7:21pm
1
Continuing the discussion from DButton no longer supports @action as a string. Please refactor to use an closure action instead :
But essentially, the message you’re seeing means that you need to change something like
{{d-button action="blah"}}
to something like:
{{d-button action=(action "blah")}}
This saved me!
My question now (besides how did it take me 9 months to do this) is whether/when to use {{d-button}}
vs <DButton>
2 Likes
david
(David Taylor)
February 15, 2024, 7:22pm
2
The modern ember pattern is to use ‘angle bracket’ syntax to invoke components. So <DButton>
is preferred.
We lint for this in core, but haven’t yet extended it to themes/plugins.
5 Likes
pfaffman
(Jay Pfaffman)
February 15, 2024, 7:30pm
3
Oh. Hooray. That’s what I thought!
It was especially confusing since the error message compained about <DButton>
but I am using {{d-button}}
. I’ll go about fixing those Real Soon Now.
Aha. Thanks for the explanation.
4 Likes
pfaffman
(Jay Pfaffman)
February 15, 2024, 10:06pm
4
Wait. So we gave up @actionParam
in <DButton>
and do this to pass stuff:
@action={{fn this.addExtraVars this.extraVarsSmtp}}
but in <NavItem>
we still stil have this to pass parameters to a route
@route="pfaffmanager.servers.show"
@routeParam={{server.id}}
3 Likes
It’s a particular case here.
<NavItem>
calls <LinkTo>
that requires the name of the route to link to (route
) and the value to fill the dynamic segment (model,
an ID here) to be separate.
<LinkTo
@route={{@route}}
@model={{@routeParam}}
>{{this.contents}}
</LinkTo>
Does that make sense?
4 Likes
pfaffman
(Jay Pfaffman)
February 16, 2024, 7:47pm
6
It’s a fine explanation and I do understand it, but I wouldn’t say it makes sense .
1 Like
It makes sense because there is no function/action involved here (and it’s not needed) in NavItem.
You only want to pass parameters from component to component. You see what I mean? Sorry, I’m so bad at explaining things.
3 Likes
pfaffman
(Jay Pfaffman)
Closed
March 17, 2024, 8:13pm
8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.