I have an interface in my application that supports properties that I want to send to my database, as well as properties that I do not have.
In particular, I support a property called state , which can be set to open or null (closed), which then calls Angular2 state animation. I use this on *ngFor lists to open the closure of the item information panel.
However, I do not want to store the state value in my database, since it is always null by default. I am currently passing the entire object to an HTTP call, so the state property is also being sent. How can I ignore it?
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); }
source share