I’m getting this strange behaviour but I’m not sure where the problem is. I’ve been following this guide to create a class and make instances of it but when I try to access one of the properties of an instance it shows the values of all them mixed.
This is what I’ve done:
I’ve created a class with:
Ember.Object.extend({
content:{}
addToContent: function(key,value)
...
}
});
then, in a component I’ve imported it and create an instance:
import MyClass from 'path/to/the/class';
...
var x = MyClass.create({});
x.addToContent("a","1");
...
and after that, in a subcomponent I do the following:
import MyClass from 'path/to/the/class';
...
var y = MyClass.create({});
y.addToContent("b","1");
...
and when I show the content of content
it has the combination {a:1, b:1}
. Shouldn’t x
and y
be different instances with their own properties? why are they getting mixed?