Reputation: 1
I have service which is getting the JSON data (object) in the form response. I want to store that JSON object in the storeCrossChannelData variable. How can I achieve this?
this.crossChannelSuccessComparison.getCrossChannelData().subscribe(response=>{
this.storeCrossChannelData = response
})
console.log(this.storeCrossChannelData);
Upvotes: 0
Views: 231
Reputation: 880
the console.log is not displaying the returned value because it is called before the service return the data try calling the console.log inside the subscribe like this
this.crossChannelSuccessComparison.getCrossChannelData().subscribe(response=>{
this.storeCrossChannelData = response
console.log(this.storeCrossChannelData);
})
Upvotes: 1