【发布时间】:2021-05-12 09:27:54
【问题描述】:
我有两个可观察的:城市和地址。在我的addresses 数组中,我有一个对象,其属性city_code 有一个值,而属性city 为空。在 cities 我有两个属性的对象。
如何转换addresses 中的数据?我想通过匹配city_code 从cities 数组中获取city 的值,并将该值放入addresses 中的相应对象中。
addresses$ = this.store.select(getAddresses);
cities$ = this.citiesFacade.allCities$;
function getAddressesWithCityName() {
// some code here
}
地址和城市:
export interface Address {
city_code: string;
city: string; // in addresses$ this property is empty and I should get it from cities$
}
export interface City{
city_code: string;
city: string;
}
【问题讨论】:
标签: angular typescript rxjs rxjs-observables