Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. {
  2. "id": 1,
  3. "product": "Gerbera",
  4. "product_type_id": 1,
  5. "description": "Gerbera L. is a genus of plants Asteraceae. It was named in honour of German botanist and medical doctor Traugott Gerber | who travelled extensively in Russia and was a friend of Carl Linnaeus.",
  6. "images": "http://factoryunlock.in/sundar/public/uploads/photos/07_17/1500965697_Growing-Gerbera-Flowers.jpg" }
  7.  
  8. import { Component } from '@angular/core';
  9. import { IonicPage, NavController, NavParams } from 'ionic-angular';
  10. import { EarthquakesProvider } from'../../providers/earthquakes/earthquakes';
  11. @IonicPage()
  12. @Component({
  13. selector: 'page-details',
  14. templateUrl: 'details.html',
  15. providers: [EarthquakesProvider]
  16. })
  17. export class DetailsPage {
  18.  
  19. // public DateList: Array<Object>;
  20.  
  21. item: any;
  22. id: number;
  23. constructor(public navCtrl: NavController, public earthquakes: EarthquakesProvider, public navParams: NavParams) {
  24.  
  25. this.id = navParams.get('id');
  26.  
  27.  
  28. }
  29. ionViewDidLoad() {
  30. this.getEarthquakes(this.id);
  31. }
  32. getEarthquakes(id) {
  33. this._earthquakes.loadEarthquakesdetails(id).subscribe(res => {
  34. this.item=res;
  35.  
  36. });
  37. }
  38.  
  39. }
  40.  
  41. <ion-header>
  42. <ion-navbar>
  43. <button ion-button menuToggle>
  44. <ion-icon name="menu"></ion-icon>
  45. </button>
  46. <ion-title> Product Details</ion-title>
  47. </ion-navbar>
  48. </ion-header>
  49.  
  50. <ion-content class="content-background">
  51.  
  52. <ion-list>
  53. <button ion-item style="background: #eee;border: 1px solid #888;height: 40px">
  54.  
  55. {{ " Flower Name :" + product }}
  56.  
  57. </button>
  58.  
  59. <ion-card >
  60. <div class=" col-50">
  61. <ion-item style="width:100%">
  62. <img [src]="images" />
  63. </ion-item>
  64. </div>
  65. </ion-card>
  66.  
  67. <button ion-item text-wrap style="background: #eee;border: 1px solid #888">
  68. <div class="item item-text-wrap">
  69.  
  70.  
  71. {{" Discription :" + description }}
  72.  
  73. </div>
  74.  
  75. </button>
  76.  
  77. <ion-list>
  78.  
  79. loadEarthquakesdetails(id) {
  80. let headers = new Headers();
  81. headers.append('Content-Type', 'application/json');
  82. headers.append('Authorization', 'Bearer ' + "eAKu0hiSYTqJTkV2yaBz6K1gVDK2TIDFcemjut3nlNoEJTRCNGEKHXRTi972");
  83. return this._http.get(`http://factoryunlock.in/sundar/public/api/v1/products/${id}`,{headers: headers})
  84. .map(res => res.json());
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement