this.model = new Model()
class Model {
private _initialValues = {
name: 'name',
surname: 'surname'
}
constructor() { }
reset() {
Object.keys(this._initialValues).forEach(key => {
this[key] = this._initialValues[key];
})
}
}
class Model {
constructor() {
this.name = 'test'
}
reset() {
const newInstance = new Test();
Object.keys(newInstance).forEach(key => {
this[key] = newInstance[key];
})
}
}
class Foo {
constructor() {
this._field = '';
}
set field(value) {
this._field = value+='Foo';
}
get field() {
return this._field;
}
}
class MyFoo extends Foo {
set field(value) {
super.field = value;
this._field += 'MyFoo';
}
}