I am trying to filter an Array based on the user name and show It but when I try to filter it doesn't show any data. User Structure Is like this
buyer: [{
address: ""
contactNo: ""
email: "[email protected]"
name: "user"}]
cutomerContact: "3058989778"
orderDate: "2019-07-31T12:10:11.818Z"
orderType: "general"
and my code to filter array is
this.userOrders = this.filteredOrders.filter(x => x.buyer = x.buyer.name == this.userName)
I have no Idea how to filter a nested data any Help would be appreciated
this.filteredOrders.filter(x => x.buyer = x.buyer.name == this.userName)withthis.filteredOrders.filter(x => x.buyer.name == this.userName)this.filteredOrders.filter(x => x.buyer[0].name == this.userName)else you have to loop over buyer inside filter