I'm having trouble assigning the value "contact.company_name" from the getClient method.
getContacts() {
this.contactService.getContacts().subscribe(
data => {
for (let contact of data) {
contact.company_name = this.getClient(contact);
console.log(contact);
}
this.contacts = data
},
error => console.log(error),
() => this.isLoading = false
);
}
The response returned by the http-request in this.getClient(contact) is:
{_id: "59f43f1a3a2fc421c00ad8b1", name: "company2", street: "street 2", zipcode: "45678",…}
How can I ensure that contact.company_name matches company.name? The ids in contact.company and company._id are the same. The http-request and response seem to be correct.
For example, a sample contact object may look like this:
{
anrede : "sir"
company : "59f43f1a3a2fc421c00ad8b1"
nachname :"surname1"
titel : "dr."
vorname : "name1"
__v : 0
_id : "59f43f363a2fc421c00ad8b2"
}