Remote JSON Data with HTTP Returns "User title undefined". PLEASE HELP!


#1

Good day all.
I am working on remote json data with http but when i run the code i get user title undefined.
please view the code below.
thanks.


Reddits.ts

import { Component } from ‘@angular/core’;
import { NavController, NavParams } from ‘ionic-angular’;
import {RedditService} from ‘…/…/providers/reddit-service’;
import {DetailsPage} from ‘…/details/details’ ;

/*
Generated class for the Reddits page.

See http://ionicframework.com/docs/v2/components/#navigation for more info on
Ionic pages and navigation.
*/
@Component({
selector: ‘page-reddits’,
templateUrl: ‘reddits.html’
})
export class RedditsPage {
items:any;
feeds:any;
posts:any;
constructor(public redditservice:RedditService, public navCtrl: NavController, public navParams: NavParams) {

}
ngOnInit(){
this.getPost();
}
getPost(){
this.redditservice.getPost().subscribe(response =>{
console.log(response);
this.items = response.feed.entry;
})
}
viewItem(item){
this.navCtrl.push(DetailsPage,{
item:item
});
}
ionViewDidLoad() {
console.log(‘ionViewDidLoad RedditsPage’);
}

}


reddit-service.ts

import { Injectable } from ‘@angular/core’;
import { Http } from ‘@angular/http’;
import ‘rxjs/add/operator/map’;

/*
Generated class for the RedditService provider.

See https://angular.io/docs/ts/latest/guide/dependency-injection.html
for more info on providers and Angular 2 DI.
*/
@Injectable()
export class RedditService {
baseUrl: any;
constructor(public http: Http) {
this.http=http;
this.baseUrl = ‘http://naijavibz.blogspot.com/feeds/posts/default?alt=json’;
console.log(‘Hello RedditService Provider’);
}
getPost(){
return this.http.get(this.baseUrl)
.map(res => res.json());
}
}


reddits.html

NaijaVibz

{{item?.entry.title}}


app.module.ts

import { NgModule, ErrorHandler } from ‘@angular/core’;
import { IonicApp, IonicModule, IonicErrorHandler } from ‘ionic-angular’;
import { MyApp } from ‘./app.component’;
import { AboutPage } from ‘…/pages/about/about’;
import { ContactPage } from ‘…/pages/contact/contact’;
import { HomePage } from ‘…/pages/home/home’;
import { TabsPage } from ‘…/pages/tabs/tabs’;
import {DetailsPage} from’…/pages/details/details’;
import {RedditsPage} from ‘…/pages/reddits/reddits’ ;

@NgModule({
declarations: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage,
DetailsPage,
RedditsPage
],
imports: [
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage,
DetailsPage,
RedditsPage
],
providers: [{provide: ErrorHandler, useClass: IonicErrorHandler}]
})
export class AppModule {}


#2

Thank you nice information