I trying to make a Web Application and I want to test the HTTP functions, but I have a problem.
For example: I have this:
import { Injectable } from '@angular/core';
import { Headers, RequestOptions, Http } from '@angular/http';
import {Observable} from 'rxjs/Rx';
// Import RxJs required methods
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
@Injectable()
export class UserService {
constructor(private http: Http) { }
create(data: Object): Observable<any> {
let headers = new Headers({'Content-Type': 'application/x-www-form-urlencoded'}),
options = new RequestOptions({ headers: headers});
return this.http.post('http://localhost:8000/api/signin', {headers:headers}).map((res) => { res.json(); alert('ma-ta'); }).catch((error:any) => Observable.throw(error.message));
}
}
The function is called, I verified, but the http.post doesn't work, I mean, it not sent the data to that link, in Console I have nothing at Network, and I receive this:
12:01:18.779 Object { _isScalar: false, source: Object, operator: Object } 1 main.bundle.js:444:9
It's a kinda empty, only things I don't need, like an error information or something. Can somebody help me ?