Sujeet Raman

Sujeet Raman

  • 785
  • 915
  • 330.6k

How to add items in json data object while sending to DB

Dec 6 2017 4:56 AM
 i need to upload abulk data of jsonobject.In service .ts i need to add extraa 4 more values to that object.In body ineed to get this values to save how can i append these 4 values to body
 
 my service.ts
************** 
SaveData(uploaddata: any) {
 
//this four data i need to add to the object "body"
// ID":ID,
// "CreatedBy": "",
// "CreatedOn": "",
// "UpdatedBy": "",
// "UpdatedOn": ""
/
let body = JSON.stringify(uploaddata)
console.log(body)
let headers = new Headers({
'Content-Type':
'application/json; charset=utf-8'
});
let options = new RequestOptions({ headers: headers });
return this._http.post(this.Savecsv, body, options)
.map(res => <data>res.json())
.catch(this.handleError);
}

Answers (2)