getProductbyFilter(filter: filterDataModel): Observable<any> {
this.stringtoArrayService.convertStringtoArray(some string input).subscribe(productUserResponse => {
if (productUserResponse) {
this.userProfileProduct = productUserResponse;
this.newParams = this.userProfileProduct[0].Function_Network;
if (this.newParams != null) {
this.updatedStr = this.newParams.replace('&', '__', this.newParams);
} else {
this.updatedStr = this.userProfileProduct[0].Function_Network;
}
}
});
return this.http.post(url + this.updatedStr, filter, httpOptions);}
I have already visited these links they said to use method inside subscribe. I want to access this.updatedStr but it's returning undefined. I can't write return inside subscribe also. Can anyone please help?