Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4830

Add objects to an array property of the model from a component. DDAU

$
0
0

@davegoulash wrote:

Hi,

I have a component that gets passed the model Point

As per DDAU I want to add to an array of shots, which is a property of Point. I therefore need to obtain or pass in the point to the registerShot action in the route:

  actions: {
    registerShot(point, shot) {
      point.get('shots').addObject(shot);
    }
  }

inside my component:
<button class="btn" {{action (route-action "registerShot" point "FH")}}>Forehand</button>

This doesn't work and is perhaps conceptually unsound?

How would I go about this? Is there a way to get the model that is loaded by the route inside that route's action?

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4830

Trending Articles