import { Component } from '@angular/core' ; import { NavController , NavParams } from 'ionic-angular' ; import { RedditApiService } from '../../providers/reddit-api-service' ; @ Component ( { selector : 'page-comments' , templateUrl : 'comments.html' , providers : [ RedditApiService ] , } ) export class CommentsPage { post ; comments ; loadCompleted : boolean = false ; constructor ( public navCtrl , public redditApi , public params ) { this . post = this . params . get ( 'post' ) ; this . load ( ) ; } load ( ) { this . redditApi . fetchComments ( this . post ) . subscribe ( ( comments ) => { this . comments = comments ; this . loadCompleted = true ; console . log ( this . comments ) ; } ) ; } }