Reputation: 91
Am having some const array values and i have the response value in subscribe and i want to check whether the const array value is availabe in response.i dont know how to use map and filter in subscribe. if the value is available then the checkval should return true other wise false.i can able to did using some function but here i needs to use rxjs operators
Response:
{
"testLoad": 1603367083993,
"checkData": "test1"
"type": "flag",
"title": "TestFlag",
"styleId": "test",
"BodyContent": {
"properties": "undefined"
}
}
const styleid: Array<string> = ['test1','test2','test3'];
public checkVal(){
this.idVal =this.data.getresponse().subscribe((response => console.log(response ));
}
since am new to angular rxjs can you please guide me and help out from this issue
Upvotes: 1
Views: 803
Reputation: 9134
As per comments I understand, that you want to return a true
Observable, if the response.checkData
value is included in the pageUid
array.
You can do the following:
this.data.getresponse().pipe(
map(response => pageUid.includes(response.checkData)),
).subscribe(checkResult => console.log(checkResult));
Upvotes: 0