Good day,
I have the following:
this.profileService.fetchUserInfo()
.subscribe(resData => {
this.uProfile = resData;
console.log('ResData: ', resData);
});
the fetchUserInfo() method returns data from http call and is stored in:
public uProfile = [];
if I do the following in html file, it does show me all the option3 values:
<ul *ngFor="let item of uProfile">
<li>{{ item.option3}}</li>
</ul>
when I console.log resData, i can see all the results as follow:
0: {option1: "1", option2: "1", option3: "venue", option4: "hall"}
1: {option1: "2", option2: "1", option3: "location", option4: "city"}
3: {option1: "3", option2: "1", option3: "capacity", option4: "500"}
4: {option1: "4", option2: "1", option3: "bookings", option4: "required"}
5: {option1: "5", option2: "1", option3: "manager", option4: "yes"}
How would I filter or get the value of one option based on another, ie:
I would like to get the VALUE of option4 WHERE option3 = bookings.
I have tried using .map & .filter… but to no avail.
Thank you in advance for your help!