【发布时间】:2021-11-26 04:24:22
【问题描述】:
我们如何在 typescript 中向对象数组插入值?
我想将 1993 年的值插入到示例对象上的每个年度租金当前值。
所以每个年度租金当前值现在都是 1993 年。有什么想法吗? .我们如何在 typescript 或 angular 中解决这个问题?谢谢。
#我要插入的数据
this.transaction.propertyDto.propertyDetailDto.annualRentUsd = 1993;
#示例对象
this.data.object = [
{
"id": 196,
"name": "Partner Deal ",
"dealType": "Partner Location Submission",
"annualRentProposed": null,
"annualRentCurrent": null,
"firmTermRemaining": null,
"firmTermAdded": null,
"maxAvailableTerm": null,
"capitalContribution": null,
"createdOnString": "09/30/2021",
"fileName": null,
"serverFileName": null,
"size": null,
"absoluteUri": null,
"sentTo": null
},
{
"id": 197,
"name": "Buyout Deal Disposition",
"dealType": "Idle Buyout",
"annualRentProposed": null,
"annualRentCurrent": null,
"firmTermRemaining": null,
"firmTermAdded": null,
"maxAvailableTerm": null,
"capitalContribution": null,
"createdOnString": "09/30/2021",
"fileName": null,
"serverFileName": null,
"size": null,
"absoluteUri": null,
"sentTo": null
},
{
"id": 199,
"name": "Sublease Deal Disposition",
"dealType": "Idle Sublease",
"annualRentProposed": null,
"annualRentCurrent": null,
"firmTermRemaining": null,
"firmTermAdded": null,
"maxAvailableTerm": null,
"capitalContribution": null,
"createdOnString": "09/30/2021",
"fileName": null,
"serverFileName": null,
"size": null,
"absoluteUri": null,
"sentTo": null
},
{
"id": 203,
"name": "Disposition of Location #10532-S",
"dealType": "PM Restructure",
"annualRentProposed": null,
"annualRentCurrent": null,
"firmTermRemaining": null,
"firmTermAdded": null,
"maxAvailableTerm": null,
"capitalContribution": null,
"createdOnString": "10/01/2021",
"fileName": null,
"serverFileName": null,
"size": null,
"absoluteUri": null,
"sentTo": null
},
{
"id": 214,
"name": null,
"dealType": "Approval to Close",
"annualRentProposed": null,
"annualRentCurrent": null,
"firmTermRemaining": null,
"firmTermAdded": null,
"maxAvailableTerm": null,
"capitalContribution": null,
"createdOnString": "10/04/2021",
"fileName": null,
"serverFileName": null,
"size": null,
"absoluteUri": null,
"sentTo": null
},
{
"id": 215,
"name": "pmpm",
"dealType": "PM Restructure",
"annualRentProposed": null,
"annualRentCurrent": null,
"firmTermRemaining": null,
"firmTermAdded": null,
"maxAvailableTerm": null,
"capitalContribution": null,
"createdOnString": "10/05/2021",
"fileName": null,
"serverFileName": null,
"size": null,
"absoluteUri": null,
"sentTo": null
}
]
【问题讨论】:
-
使用RxJs的filter算子怎么样? learnrxjs.io/learn-rxjs/operators/filtering/filter
标签: javascript angular angularjs typescript