How it works...

You can start looking at the template because that is where the social media content is extracted from. The subject value is from the #messageSubject local variable, as illustrated:

<ion-item> 
  <h2 #messageSubject>Ionic Developer</h2> 
  <p>May 5, 2016</p> 
</ion-item> 

In the preceding case, the subject is Ionic Developer because you will access messageSubject.innerText later on. messageSubject is just referencing your H2 DOM node.

Similarly, the body is from #messageBody, as shown here:

<ion-card-content> 
  <p #messageBody>Wow Ionic 2 is so awesome. I gotta share this to other people.</p> 
</ion-card-content> 

When the user clicks on the SHARE button, it will trigger the sendShare() method, as follows:

<button ion-button color="primary" ...

Get Ionic Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.