im working on angular2 typescript project ,I just want to reset the object's key to '' after calling save( ) function , example is below
export class Events{
event:any={ name : '', date : '',.........};
eventOriginal=this.event;
save(){
//save(this.event)
//after save, reset value to initial state
this.event=this.eventOriginal;
}
}
but in console.log(this.event) the value is not cleared, both objects are same. i tried to assign value from constructor too, so, what is the proper way to reset keys of object in typescript ?