angular2 services - Angular 2 RC 4 Http post not firing -
i trying fire post request app , it's not working, tried multiple ways. don't see request being fired under network tab in chrome. not sure problem is, appreciated.
import { injectable } '@angular/core'; import { http, headers } '@angular/http'; @injectable() export class userservice{ private _url="users"; constructor(private _http: http){ } checkifusernameexists(username){ return this._http.get(this._url+"/"+username) .map(response => response.json()) } createuser(user){ let headers = new headers(); headers.append('content-type', 'application/json') console.log(json.stringify(user)); return this._http.post(this._url, json.stringify(user),{headers: headers}) .map(response => response.json()) }
}
first need capture error , solve error:
this._http.post(this._url, json.stringify(user),{headers: headers}) .subscribe( (res) => { // on success }, (err) => { // on error console.error(err); }
Casino no deposit bonus codes for 2021
ReplyDeleteIn 브라 밝기조절 addition to bonus codes, you can use promo pci 슬롯 codes to receive free 승인전화없는토토사이트 bonuses at casinos. Claim bonus codes 바카라양방 for games and start playing. 사설 토토 계좌 협박 Sign up at Casino