From 4306d14e9300e7c47bb20f3911d6415e1d8bc3c7 Mon Sep 17 00:00:00 2001 From: kj1352 Date: Thu, 15 Apr 2021 18:58:09 +0530 Subject: [PATCH] League table made shareable --- src/app/league-table/league-table.page.html | 2 +- src/app/league-table/league-table.page.ts | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/app/league-table/league-table.page.html b/src/app/league-table/league-table.page.html index ce64369..8dbfed6 100644 --- a/src/app/league-table/league-table.page.html +++ b/src/app/league-table/league-table.page.html @@ -4,7 +4,7 @@
IPL Standings Table
Season 2021
-
+
diff --git a/src/app/league-table/league-table.page.ts b/src/app/league-table/league-table.page.ts index cccfff3..c9f0040 100644 --- a/src/app/league-table/league-table.page.ts +++ b/src/app/league-table/league-table.page.ts @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { Location } from '@angular/common'; import { MatchService } from '../services/match.service'; import { ToastService } from '../services/toast.service'; +import { SocialSharing } from '@ionic-native/social-sharing/ngx'; export interface MobileAppStanding { id: string; @@ -31,9 +32,24 @@ export class LeagueTablePage implements OnInit { constructor( private location: Location, private matchService: MatchService, - private toastService: ToastService + private toastService: ToastService, + private socialSharing: SocialSharing, ) { } + + share() { + let message = 'IPL League Table Standings 2021- '; + + for (let i = 0; i < this.standings.length; i += 1) { + message += this.standings[i].short_name + (i + 1 === this.standings.length ? '.' : ', '); + } + + message += ' To know more please visit the link! #SaddaPunjab'; + + this.socialSharing.share(message, '', '', 'https://www.punjabkingsipl.in/points-table'); + console.log(message, '', '', 'https://www.punjabkingsipl.in/points-table'); + } + ngOnInit() { this.matchService.getLeagueTable().then((data: Array) => { this.standings = data;