【发布时间】:2019-11-06 21:26:53
【问题描述】:
我正在使用 Ionic 3,在我的主页上,我有以下代码。当我单击 searchMore 按钮时,它会导航到一个新页面。我想在新页面的 h5 中包含“Cook With What is in My Pantry”。
<ion-grid>
<ion-row>
<ion-col col-9>
<h5 name="cookWith">Cook With What is in My Pantry</h5>
</ion-col>
<div class="applyMore">
<ion-col col-3>
<button (click)="searchMore()" ion-button clear icon-left>
More
<ion-icon name='arrow-forward'></ion-icon>
</button>
</ion-col>
</div>
</ion-row>
</ion-grid>
在它链接到的页面上,我希望 h5 出现在以下代码中。
<h5 name="cookWith">{{cookWith}}</h5>
在我的 .TS 文件中,我有以下内容
从首页
export class HomePage {constructor(public navCtrl: NavController,
public navParams:
NavParams) {
}
/**
*links filter button to FilterPage
*/
recipeFilter(event, button) {
this.navCtrl.push(FilterPage, {
button: button
});
}
searchMore(event, button) {
this.navCtrl.push(RecipesearchPage, {
});
;
}
}
它链接到的页面
export class RecipesearchPage {
constructor(public navCtrl: NavController, public navParams:
NavParams) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad RecipesearchPage');
}
/**
*on click, links from recipe card to individual recipe page
*/
individualRecipe() {
this.navCtrl.push(RecipePage);
};
}
【问题讨论】: