import { Component } from '@angular/core' ; import { IonicPage } from 'ionic-angular' ; import { NavController } from 'ionic-angular' ; import { Rest } from '../../providers/rest' ; @ IonicPage ( ) @ Component ( { selector : 'page-home' , templateUrl : 'home.html' } ) export class HomePage { countries : string [ ] ; errorMessage : string ; constructor ( public navCtrl , public rest ) { } ionViewDidLoad ( ) { this . getCountries ( ) ; } getCountries ( ) { this . rest . getCountries ( ) . subscribe ( countries => this . countries = countries , error => this . errorMessage = < any > error ) ; } }