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

How to get current record to edit attribute?

$
0
0

@danmalone89 wrote:

// fund model (each fund record belongs to 1 strategy record)
    export default DS.Model.extend({
        fund: belongsTo('available-fund'),
        weight: DS.attr('number'),
        strategy: belongsTo('strategy'),
    });

And this form.hbs

{{input type="text" class="form-control" required=true value=strategy.strategyName}}
{{#each strategy.strategyFunds as |fund|}}
<tr>
    <td>Fund Weight: {{input type="text" class="form-control" value=fund.weight}}</td>
</tr>
{{/each}} 
`<button type="button" class="btn btn-info mr-2" {{action 'updateStrategy' strategy}} >Save Strategy Changes</button>`

This is my action when the user clicks save, for now.

        updateStrategy(strategy) {
            strategy.save()
        }

I want the user to be able to save the fund.weight value of each fund in a strategy, when the user actuates updateStrategy. What’s not clear is how to get the values from each {{input}} and the fund.id of each fund as well.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles