Javascript 映射对象具有旧值

Javascript 映射对象具有旧值,javascript,angular,typescript,Javascript,Angular,Typescript,所以我一直在调整我的代码以适应其他团队的代码,但我从一个事件发射器获得了旧信息 在该功能中: addEvent(事件?:MatDatepickerInputEvent){ if(事件类型!==‘未定义’){ this.refDate=event.value; this.refDate=新日期(this.refDate); this.startDate=新日期(this.refDate); }else if(typeof this.globals.contextDate===‘未定义’){ thi

所以我一直在调整我的代码以适应其他团队的代码,但我从一个事件发射器获得了旧信息

在该功能中:

addEvent(事件?:MatDatepickerInputEvent){
if(事件类型!==‘未定义’){
this.refDate=event.value;
this.refDate=新日期(this.refDate);
this.startDate=新日期(this.refDate);
}else if(typeof this.globals.contextDate===‘未定义’){
this.refDate=新日期();
this.refDate=新日期(this.refDate.getFullYear(),this.refDate.getMonth(),0);
this.startDate=新日期(this.refDate);
}否则{
this.refDate=this.globals.refDate;
this.startDate=新日期(this.refDate);
}
此.refDate.setHours(20);
const dateStr=this.refDate.toISOString().substring(0,10);
this.globals.contextDate=dateStr;
this.globals.refDate=this.refDate;
//仪表板上的操作程序
这个.getProcessState(dateStr);
//帕拉奥斯菲尔霍斯公寓
this.refDateChange.emit({
processClasses:this.processClasses,
refDate:this.refDate
});
this.startDate.setMonth(this.refDate.getMonth());
返回此.startDate;
}
检测datepicker何时更改其值,并应在此之后发出更新的信息。 但是当我收到其他组件的信息时,map对象会带来旧信息

当我创建控制台日志时:

this.captoolsComp.refDateChange.subscribe(数据=>{
this.processClasses=data.processClasses;
console.log(this.processClasses)
});
我展示了这一点:

因此,您可以看到键“Universo”(例如)的值不同。 我能做些什么来解决这个问题


非常感谢。

可能是@James的重复,但我在该组件中得到的值是首先显示的值,而不是较新的值。易于检查,
console.log(JSON.stringify(this.processClasses))应该显示“正确”的数据。@James如果我在变量“data”上这样做-I revive:{“processClasses”:{},“refDate”:“2019-04-30T19:00:00.000Z”}您可以在传输时尝试创建一个新对象:`` this.refDateChange.emit({processClasses:object.assign({},this.processClasses),refDate:this.refDate})```