mercredi 6 avril 2016

Javascript reset object inside array

I have the below JS code in my Ember app that gets called;

myPanels.accordionPanels = [];
myPanels.accordionPanels.push({
    panel: {
        name: "my-grid",
        type: 'comp',
        props: [{
            key: 'elementId',
            value: "myCustomId"
        }]
    }
});

So as you can see, I start by setting myPanels.accordionPanels = [] every time and then push the object.

However, I got the following error

Assertion Failed: Attempted to register a view with an id already in use: myCustomId

So I am assuming that the object inside is not getting reset & it is able to find the earlier created "myCustomId".

Am I resetting the array (or rather the object inside it) correctly ?




Aucun commentaire:

Enregistrer un commentaire