Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Injectable } from '@angular/core';
- import { Http } from '@angular/http';
- import 'rxjs/add/operator/map';
- @Injectable()
- export class HomeService {
- public data: any;
- public api_url: string;
- constructor(public http: Http) {
- this.api_url = 'https://segredosuesc.herokuapp.com';
- }
- // Carrega a listagem de Fotos
- load() {
- return new Promise(resolve => {
- this.http.get(this.api_url + '/segredos/')
- .map(res => res.json())
- .subscribe(data => {
- this.data = data;
- console.log(data);
- resolve(this.data);
- });
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement