In my application's interface, I manage certain properties that need to be sent to the database while excluding others.
One specific property I handle is called state
, which can have a value of open
or null
(closed). This property triggers Angular2's Animation state function. I utilize this in lists using *ngFor
to toggle the visibility of information panels related to each item.
However, since the default value for state
is always null
, I prefer not to store it in the database. Currently, when making an HTTP call, the entire object is passed along including the state
property. Is there a way to ignore this specific property?
pushItemToDay(item: any, dateStr: Date): void {
let body = JSON.stringify(item);
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
this.http.post(this.baseURL + 'api/addItem/' + dateStr, body, options)
.toPromise()
.catch(this.handleError);
}