jeudi 9 novembre 2017

Array value is being persisted in mutlple instances of same component

I have a component with property arr:[], and i am pushing some value to this property by this.get('arr').push('value one'); on init. If i use this component multiple times, the arr's value is being persisted in all the other components. For ex: If i push some value on component init, this.get('arr').push('value one'). If i use this component for one time it works fine, but for second use/instance, arr already has length 1 before i push to it.

Have a look at the console of this twiddle.

http://ift.tt/2m7Dbil

Is this behavior odd or it is supposed to work like this?




Aucun commentaire:

Enregistrer un commentaire