Advertisement
widana

Untitled

Oct 29th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.49 KB | None | 0 0
  1. ubah di home.html:
  2. line 12 <ion-item text-wrap *ngFor="let headline of headlines" (click)="openNavDetailsPage(headline)">
  3.  
  4. line 23 <ion-item text-wrap *ngFor="let headline1 of headliness " (click)="openNavDetailsPage(headline1) ">
  5.  
  6. ubah dihome.ts:
  7.   openNavDetailsPage(headline) {
  8.     this.navCtrl.push(DetailPage,{itemHeadline: headline})
  9.   }
  10.  
  11. ubah di detail.ts:
  12. import { Component } from '@angular/core';
  13. import { IonicPage, NavController, NavParams } from 'ionic-angular';
  14. import { RestProvider } from '../../providers/rest/rest';
  15. import { Post_id} from '../../providers/providers';
  16. import { Api } from '../../providers/api/api';
  17.  
  18. /**;;
  19.  * Generated class for the DetailPage page.
  20.  *
  21.  * See https://ionicframework.com/docs/components/#navigation for more info on
  22.  * Ionic pages and navigation.
  23.  */
  24.  
  25. @IonicPage()
  26. @Component({
  27.   selector: 'page-detail',
  28.   templateUrl: 'detail.html',
  29. })
  30. export class DetailPage {
  31.   defaultItems: any;
  32.   users: any;
  33.   item: any;
  34.  
  35.   constructor(public navCtrl: NavController, public navParams: NavParams, public restProvider: RestProvider, public post_id: Post_id,public post_title: Post_title, public api: Api) {
  36.  
  37.     this.item = navParams.get('itemHeadline');
  38.     console.log(this.item);
  39.  
  40.  
  41.   }
  42. }
  43.  
  44.  
  45. ubah di detail.html
  46.  
  47. <ion-header>
  48.  
  49.     <ion-navbar>
  50.         <ion-title>{{ item.post_id }}</ion-title>
  51.     </ion-navbar>
  52.  
  53. </ion-header>
  54.  
  55.  
  56. <ion-content>
  57.  
  58.     <div class="bold">
  59.  
  60.         {{ item.post_title }}
  61.  
  62.     </div>
  63.  
  64.  
  65. </ion-content>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement