Guest User

Untitled

a guest
Jan 17th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. [
  2. {
  3. "id": 1,
  4. "username": "Emanuel",
  5. "email": "emanuel",
  6. "password": "123",
  7. "created_at": "2018-01-17T12:04:43.000Z",
  8. "updated_at": "2018-01-17T12:04:43.000Z"
  9. }
  10. ]
  11.  
  12. import { HttpClient } from '@angular/common/http';
  13. import { Injectable } from '@angular/core';
  14.  
  15. @Injectable()
  16. export class RestProvider {
  17.  
  18. constructor(public http: HttpClient) {
  19. console.log('Hello RestProvider Provider');
  20. }
  21.  
  22. apiUrl = 'http://localhost:3000';
  23.  
  24. getUsers(){
  25. return new Promise(resolve => {
  26. this.http.get(this.apiUrl+'/users').subscribe(data => {
  27. console.log(data);
  28. }, err => {
  29. console.log(err);
  30. });
  31. });
  32. }
  33. }
Add Comment
Please, Sign In to add comment