如何解决属性中的有角订阅返回值
我需要从订阅中使用值并在返回日期时间的属性上使用,但我不知道如何使用
组件
ngOnInit() {
this.resetForm();
let defautWIPEndTime = this.service.getDefautWIPEndTime().subscribe(res => {});
console.log(defautWIPEndTime);
}
resetForm(form?: NgForm) {
if (form != null)
form.form.reset();
this.service.plan = {
Id: 0,Name: '',Description: '',CreatedOn: this.defautWIPEndTime,}
}
订阅退货
{$id: "20",DefautWIPEndTime: "17:30:00"}
我需要在属性17:30:00
上放置价值CreatedOn
=我需要什么=
this.service.plan = {
Id: 0,CreatedOn: 17:30:00,<=======================
}
我还有其他问题,订阅者如何返回Just Time。现在它返回对象了
=现在结果=
this.service.plan = {
Id: 0,CreatedOn: {$id: "20",DefautWIPEndTime: "17:30:00"},<=======================
}
解决方法
我假设订阅的结果只是一个日期,那么您只需在订阅时进行设置即可。
ngOnInit() {
this.resetForm();
this.service.getDefautWIPEndTime().subscribe(res => {
this.service.plan.CreatedOn= res;
});
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。