private url = '/assets/accounts/account-details.json';
createService(param: AccountDetails): Observable<accountdetails> { let headers = new Headers({ 'Content-Type': 'application/json' }); let body = JSON.stringify(param); let options = new RequestOptions({ headers: headers }); return this.http .post(this.url, body, options) .map(this.extractData) .catch(this.handleError); }
createAccountDetail() { let acd: AccountDetails[] = [{ accountNumber: "23459501", tranDate: "09-Apr-2018", tranDetails: "ATM Withdraw", tranType: "Debit", tranAmount: 100.00, balance: 100 }]; let accountDetail = acd[0]; this.accountService.createService(accountDetail) .subscribe( result => console.log(result), error => this.errorMessage = <any>error ); }
return this.http.get(this.dataUrl) .map(response => response.json()) .catch(error => Observable.throw(error.json()));
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)