I am using angular2 http.post in the following service:
import {Injectable, Inject} from 'angular2/core'
import {Http, Response, RequestOptions, Headers, Request, RequestMethod} from 'angular2/http';
import 'rxjs/add/operator/map';
//Globals
const URL : string = 'http://myurl.com/listings';
@Injectable()
export class ListingsService {
//Constructor
constructor(public http: Http) {}
postListing(data) {
this.http.post(URL, data).map(res => res.json())
}
}
The issue is that I am only allowed to post data as a string inside http.post, where as I need to pass in an Object.