Closed Mojo90 closed 7 years ago
Right, it looks like a bug. Basically when extending a model, all properties from the parent prototype are copied : https://github.com/sylvainpolletvillard/ObjectModel/blob/master/src/model.js#L78
The bug here is that it also includes the constructor
property, that's why you get obj.constructor === Address
and not Customer. But the Customer definition is fine, see console.log(Customer)
.
If I am right, this should be a one-line fix to skip the constructor
property. I will do it tonight.
fixed in 2.6.2 thanks for the report :+1:
You are right but as I use it now as a Data Model for my backend I have only the object in my classes and not the Customer Class itself. So great for the fast fix, thank you!
What I get from your Docs:
Now if I do:
It prints out:
For me
id
is missing here in the definition as I understand from docs or did I get sth. wrong?