Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

home.page.ts 2.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import { Component, OnInit } from '@angular/core';
  2. @Component({
  3. selector: 'app-home',
  4. templateUrl: './home.page.html',
  5. styleUrls: ['./home.page.scss'],
  6. })
  7. export class HomePage implements OnInit {
  8. selectedTab: string = 'news';
  9. slideOpts = { };
  10. newsData: Array<{
  11. id: string | number,
  12. image: string,
  13. heading: string,
  14. description: string,
  15. type: 'VIDEO' | 'ARTICLE',
  16. likes: number,
  17. isBookmarked: boolean,
  18. isLiked: boolean,
  19. comments: Array<{
  20. user: string,
  21. comment: string,
  22. likes: number
  23. }>,
  24. }> = [];
  25. constructor() { }
  26. ngOnInit() {
  27. this.newsData = [{
  28. id: 1,
  29. image: 'https://s3.india.com/wp-content/uploads/2020/10/Mayank-Agarwal-celebrates-Kings-XI-Punjabs-win-over-Mumbai-Indians-in-match-37-of-Dream11-IPL-2020-in-Dubai%C2%A9KXIP-Twitter.jpg',
  30. heading: 'KXIP beat MI by 3 Wickets',
  31. description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste ab qui, incidunt illo dolore laboriosam sapiente deserunt officiis ullam. Explicabo accusantium quia tempore totam repellat amet debitis adipisci deserunt iste.',
  32. type: 'VIDEO',
  33. likes: 10,
  34. isLiked: false,
  35. isBookmarked: false,
  36. comments: [{
  37. user: 'kxipFan',
  38. comment: 'Yay!',
  39. likes: 2,
  40. }, {
  41. user: 'SehwagFan',
  42. comment: 'finally!',
  43. likes: 5,
  44. }]
  45. }, {
  46. id: 2,
  47. image: 'https://www.ak4tsay1.com/wp-content/uploads/2020/02/Kings-XI-Punjab-KXIP-Strengths-and-Weakness-for-IPL-2020-800x445.jpg',
  48. heading: 'KL Rahul scores fastest 100',
  49. description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iste ab qui, incidunt illo dolore laboriosam sapiente deserunt officiis ullam. Explicabo accusantium quia tempore totam repellat amet debitis adipisci deserunt iste.',
  50. type: 'ARTICLE',
  51. isLiked: false,
  52. isBookmarked: false,
  53. likes: 308,
  54. comments: []
  55. }];
  56. this.slideOpts = {
  57. slidesPerView: 1.3,
  58. spaceBetween: 30,
  59. slidesOffsetBefore: 30,
  60. slidesOffsetAfter: 30,
  61. }
  62. }
  63. }