Seeking guidance on utilizing angular2 and facing challenges extracting a value within the subscribe() function. I am aware it is currently returning null. Any advice provided would be greatly appreciated. Thank you :)
Below is the code snippet in question:
this.deliveryService.deliveryCancel(rowInfo.branchId, rowInfo.id).subscribe(
res => {
var data = res.json();
this.getDeliveryList();
this.msgs.push({ severity: 'success', summary: 'Info', detail: rowInfo.deliveryStatus });
},
err => {
this.errMessage = <any>err;
this.msgs.push({ severity: 'error', summary: 'Error', detail: this.errMessage });
}
);
console.log(data);
deliveryCancel()
deliveryCancel(branchId, deliveryId) {
const headers = new Headers({
'Content-Type': 'application/json'
});
return this.http.put(this.testUrl + '/admin/branches/' + branchId + '/deliveries/' + deliveryId + '/cancel', {
headers: headers
})
.catch(handleError);
}