Social Sharing

Share content from your Ionic App using the social networks or social apps. Learn how we integrated this feature in Ion2FullApp Ionic Template.

We use this plugin to give the app the power to share text, files, images, and links via social networks, sms, and email.

To install run:

$ ionic plugin add cordova-plugin-x-socialsharing --save
$ npm install --save @ionic-native/social-sharing

This plugin is super easy to use and to install. Learn more in the official documentation.

feed.html
<button class="action-button" ion-button clear small (click)="sharePost(post)" icon-left>
     <ion-icon name='share-alt'></ion-icon>Share
</button>
feed.ts
sharePost(post) {
  //this code is to use the social sharing plugin
  // message, subject, file, url
  SocialSharing.share(post.description, post.title, post.image)
  .then(() => {
     console.log('Success!');
  })
  .catch(() => {
     console.log('Error');
  });
}

Last updated