mardi 10 juillet 2018

Emberjs view not updating on new record creation?

I have route which uses ember hash to load multiple models like

import Route from '@ember/routing/route';

export default Route.extend({
    model(params) {
        return Ember.RSVP.hash({
            contest: this.store.query('contest',{match: params.matchId}),
            match: this.store.findRecord('match', params.matchId)
        })
    }
});

and i create a new instance of contest in controller using the following code

    newContest() {
         this.store
            .createRecord('contest', {
                name: this.get('contestName'),
                fee: this.get('contestFee'),
                winning: this.get('contestWinning'),
                capacity: this.get('contestCapacity'),
                match: this.get('model').match.get('id')
            })
            .save();
    }

The problem being that it is not reflected in template which i am rendering as follows

        
        <tr>
            <td></td>
        </tr>
        

where am i going wrong with this ?




Aucun commentaire:

Enregistrer un commentaire