Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ubah di home.html:
- line 12 <ion-item text-wrap *ngFor="let headline of headlines" (click)="openNavDetailsPage(headline)">
- line 23 <ion-item text-wrap *ngFor="let headline1 of headliness " (click)="openNavDetailsPage(headline1) ">
- ubah dihome.ts:
- openNavDetailsPage(headline) {
- this.navCtrl.push(DetailPage,{itemHeadline: headline})
- }
- ubah di detail.ts:
- import { Component } from '@angular/core';
- import { IonicPage, NavController, NavParams } from 'ionic-angular';
- import { RestProvider } from '../../providers/rest/rest';
- import { Post_id} from '../../providers/providers';
- import { Api } from '../../providers/api/api';
- /**;;
- * Generated class for the DetailPage page.
- *
- * See https://ionicframework.com/docs/components/#navigation for more info on
- * Ionic pages and navigation.
- */
- @IonicPage()
- @Component({
- selector: 'page-detail',
- templateUrl: 'detail.html',
- })
- export class DetailPage {
- defaultItems: any;
- users: any;
- item: any;
- constructor(public navCtrl: NavController, public navParams: NavParams, public restProvider: RestProvider, public post_id: Post_id,public post_title: Post_title, public api: Api) {
- this.item = navParams.get('itemHeadline');
- console.log(this.item);
- }
- }
- ubah di detail.html
- <ion-header>
- <ion-navbar>
- <ion-title>{{ item.post_id }}</ion-title>
- </ion-navbar>
- </ion-header>
- <ion-content>
- <div class="bold">
- {{ item.post_title }}
- </div>
- </ion-content>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement