2017-03-18 1 views
0

j'applique le partage social dans l'application ionique avec this pluginLa mise en œuvre partage social à l'intérieur de diapositives ioniques

Dans ma page J'utilise des diapositives ioniques,

<ion-slides> 
    <ion-slide *ngFor="let item of strings"> 
     <div> 
     {{ item }} 
     </div> 
    </ion-slide> 
    </ion-slides> 

Ceci est mon fichier d'enregistrement pour obtenir des données dans les diapositives

export class Birthday { 
strings : Array<string>; 
    constructor(public navCtrl: NavController, public navParams: NavParams) { 
    this.strings = new Array<string>(); 
    this.strings.push('text1'); 
    this.strings.push('text2'); 
    this.strings.push('text3'); 
    this.strings.push('text4'); 

    } 
} 

maintenant, tout en utilisant le partage social plug-in comment obtenir des données de diapositive en cours dans le champ de message

share(**slide data heree**, subject, file, link) { 
    this.platform.ready().then(() => { 
     if(window.plugins.socialsharing) { 
      window.plugins.socialsharing.share(message, subject, file, link); 
     } 
    }); 
} 

Répondre

1

Utilisez viewChild pour obtenir les diapositives dans le composant.

import { Slides } from 'ionic-angular'; 

@ViewChild(Slides)slides:Slides 

//To get current slide, 
let index = this.slides.getActiveIndex(); 

//Get the item as: 
this.strings[index] 

Documentation pour slides