Parcourir la source

League table made shareable

master
kj1352 il y a 4 ans
Parent
révision
4306d14e93
2 fichiers modifiés avec 18 ajouts et 2 suppressions
  1. +1
    -1
      src/app/league-table/league-table.page.html
  2. +17
    -1
      src/app/league-table/league-table.page.ts

+ 1
- 1
src/app/league-table/league-table.page.html Voir le fichier

@@ -4,7 +4,7 @@
<button (click)="back()"> <ion-icon name="chevron-back-outline"></ion-icon> <span> BACK </span> </button>
</div>
<header> IPL Standings Table <br> <span> Season 2021 </span> </header>
<div class="action">
<div class="action" (click)="share()">
<button> <ion-icon name="share-social"></ion-icon> </button>
</div>
</section>


+ 17
- 1
src/app/league-table/league-table.page.ts Voir le fichier

@@ -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<MobileAppStanding>) => {
this.standings = data;


Chargement…
Annuler
Enregistrer