Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. import { Injectable } from '@angular/core';
  2. import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http';
  3. import { Observable } from 'rxjs/Observable';
  4. import { Name } from './name';
  5.  
  6. const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json' })};
  7.  
  8. @Injectable()
  9. export class DataService {
  10.  
  11. constructor(private http: HttpClient) { }
  12.  
  13. saveName(name: Name) {
  14. const body = JSON.stringify(name.name);
  15. return this.http.post('http://localhost:81/apitest/src/app/data/name.php', body, httpOptions);
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement