HTML document example
<ion-header>
<ion-toolbar color="danger">
<ion-buttons>
<button ion-button navPop icon-only>
<ion-icon ios="ios-arrow-back" md="md-arrow-back"></ion-icon>
</button>
</ion-buttons>
<ion-title text-wrap>Volunteer Selection</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<h1>{{volunteer.title}}</h1><br/>
</ion-content>
TypeScript file example
import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
@Component({
selector: 'page-volunteer-vote-detail',
templateUrl: 'volunteer-vote-detail.html',
})
export class VolunteerVoteDetailPage {
volunteer:any;
constructor(public navCtrl: NavController, public navParams: NavParams) {
this.volunteer = navParams.get('volunteer');
}
}
In previous pages, I have used
this.volunteer = navParams.get('volunteer');
to retrieve data, but in this page, I am encountering an error
Error:
ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'title' of undefined TypeError: Cannot read property 'title' of undefined at Object.eval [as updateRenderer] (VM3975 VolunteerVoteDetailPage.ngfactory.js:64) at Object.debugUpdateRenderer [as updateRenderer] (VM3846 vendor.js:14729) at checkAndUpdateView (VM3846 vendor.js:13865) at callViewAction (VM3846 vendor.js:14210) at execComponentViewsAction (VM3846 vendor.js:14142) at checkAndUpdateView (VM3846 vendor.js:13866) at callWithDebugContext (VM3846 vendor.js:15092) at Object.debugCheckAndUpdateView [as checkAndUpdateView] (VM3846 vendor.js:14629) at ViewRef_.detectChanges (VM3846 vendor.js:11652) at Tab.NavControllerBase.viewAttachToDOM (VM3846 vendor.js:49817) at Object.eval [as updateRenderer] (VM3975 VolunteerVoteDetailPage.ngfactory.js:64) at Object.debugUpdateRenderer [as updateRenderer] (VM3846 vendor.js:14729) at checkAndUpdateView (VM3846 vendor.js:13865) at callViewAction (VM3846 vendor.js:14210) at execComponentViewsAction (VM3846 vendor.js:14142) at checkAndUpdateView (VM3846 vendor.js:13866) at callWithDebugContext (VM3846 vendor.js:15092) at Object.debugCheckAndUpdateView [as checkAndUpdateView] (VM3846 vendor.js:14629) at ViewRef.detectChanges (VM3846 vendor.js:11652) at Tab.NavControllerBase._viewAttachToDOM (VM3846 vendor.js:49817) at c (VM3844 polyfills.js:3) at Object.reject (VM3844 polyfills.js:3) at Tab.NavControllerBase._fireError (VM3846 vendor.js:49580) at Tab.NavControllerBase._failed (VM3846 vendor.js:49573) at VM3846 vendor.js:49620 at t.invoke (VM3844 polyfills.js:3) at Object.onInvoke (VM3846 vendor.js:4979) at t.invoke (VM3844 polyfills.js:3) at r.run (VM3844 polyfills.js:3) at VM3844 polyfills.js:3
Edit:
https://i.sstatic.net/BbwrQ.png
UPDATE:
TypeScript file update
goToVolunteerVoteDetail(volunteerItem:any) {
this.navCtrl.push(VolunteerVoteDetailPage,{
volunteer:volunteerItem
});
}
HTML document update
(click)="goToVolunteerVoteDetail(volunteer)"