samedi 26 septembre 2020

How to Copy Values to Empty Object List in Ember

I have an empty ember object list.

formattedlist: [
    {
        id:'',
        topic:'',
        content:''
    }
]

I push values to this list while iterating from another.

    _languageChange: function () {
    let that = this;
    let languageTexts = this.get('app').lang;

    this.get('formattedlist').clear();

    Ember.$.each(this.get('quizlist'),function(index, params) {
        let topic = languageTexts.messages[params.topic];
        let content = languageTexts.messages[params.content];
        that.get('formattedlist').pushObject({id:params.id, topic: topic, content: content});
    });
}

And it works fine. Instead of clearing and pushing object I need to create a local object list and set values to the local one.

And assign that list to the class level variable formattedlist: []. I'm using ember 1.1 version.
Please help me. Thank you.




Aucun commentaire:

Enregistrer un commentaire