Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [
- {
- "id": 1,
- "username": "Emanuel",
- "email": "emanuel",
- "password": "123",
- "created_at": "2018-01-17T12:04:43.000Z",
- "updated_at": "2018-01-17T12:04:43.000Z"
- }
- ]
- import { HttpClient } from '@angular/common/http';
- import { Injectable } from '@angular/core';
- @Injectable()
- export class RestProvider {
- constructor(public http: HttpClient) {
- console.log('Hello RestProvider Provider');
- }
- apiUrl = 'http://localhost:3000';
- getUsers(){
- return new Promise(resolve => {
- this.http.get(this.apiUrl+'/users').subscribe(data => {
- console.log(data);
- }, err => {
- console.log(err);
- });
- });
- }
- }
Add Comment
Please, Sign In to add comment