jeudi 23 mai 2019

In-template pattern to pass variable to a passed down action (contextual component)

Is it possible to pass a variable to a passed down action entirely in-template?

eg. Parent Component



Child Component


   


..that doesn't work, but it shows an idea of the desired behaviour.

What I current have to do is make an action in item-component to trigger the passed down action with the variable.

eg. Parent Component

  actions: {
    setActiveItem(item) {
      set(this, "activeItem", item);
    }
  }

Parent Component Template



Child Component

  actions: {
    click(item) {
      this.itemClick(item);
    }
  }

Child Component Template


   


What I'm trying to ask, is there a way to skip creating the wrapper action in the child template? Is there an Ember helper where this just works? eg.






Aucun commentaire:

Enregistrer un commentaire