Advertisement
rodrigofbm

home.ts

Apr 7th, 2017
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Component } from '@angular/core';
  2.  
  3.  
  4.  
  5. // Carregando nosso service que vai se comunicar com a API
  6. import {HomeService} from '../../providers/home-service';
  7.  
  8. @Component({
  9.   selector: 'page-home',
  10.   templateUrl: 'home.html',
  11.   providers: [HomeService]
  12. })
  13. export class HomePage {
  14.  
  15.   // Cricando nossa variavel que vai armazenar as fotos
  16.   public segredos: any;
  17.  
  18.   constructor(public homeService: HomeService) {
  19.     // Chama a listagem de fotos quando a página é carregada
  20.     this.loadHome();
  21.   }
  22.  
  23.   // Chama o service para montar a listagem de fotos
  24.   loadHome(){
  25.     console.log('hey');
  26.     this.homeService.load()
  27.     .then(data => {
  28.       console.log(data);
  29.       this.segredos = data;
  30.     });
  31.   }
  32.  
  33.  
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement