Open viniciussbs opened 7 years ago
When you use the component
helper, your polymorphic components must have identical arguments.
In your example, you have to refactor user=model
and event=model
into a common name: modalModel
.
But if some of the components needs a unique argument, you'll be passing it as usual, e. g. eventGroup=eventGroup
. A user modal would simply ignore that argument.
You already know that. So why don't you apply the same principle to actions? Use common names for shared actions, use unique names for non-shared actions.
In this example I've separated shared attributes and actions from unique attributes and actions:
{{component componentName
modalModel = model
like = (route-action "like")
eventGroup = eventGroup
joinEvent = (route-action "join")
}}
This approach does not require making such changes to ember-route-action-helper
that are unlikely to be used by anyone else.
Hi.
Inside my app a use
component
helper to dynamically call a component. But the attributes may vary depending of which component I'm calling.Let's say I have this code:
I would like to write it this way:
In this case,
modalActions
is a hash with the actions. But, to do this, I need a way to useroute-action
logic inside a mixin. Thechangeset
helper uses internally aChangetset
class that can be used anywhere. It would be great to have aRouteAction
class, too.