I'd have an ionic project that i want to integrate social media sharing on but it seams not working as i keep getting error each time i want to use the class in my constructor. the page will not even load with this on the console.
ERROR Error: Uncaught (in promise): TypeError: Object(...) is not a function
TypeError: Object(...) is not a function
This what i got from the ionic documentation
- ionic cordova plugin add cordova-plugin-x-socialsharing
- npm install --save @ionic-native/social-sharing@4
import { SocialSharing } from "@ionic-native/social-sharing";
constructor(private socialSharing: SocialSharing){}
compilemsg(index): string {
var msg = this.post[index].body + "..." + this.post[index].title;
return msg.concat(" \n Awesome !");
}
shareMedia(index) {
var msg = this.compilemsg(index);
this.socialSharing.share(msg, null, null, null);
}
HTML CODE
<div text-center *ngIf="post; let i = index;">
<ion-col class="share" size="6" text-right [ngClass]="{ 'show-favorite': isFavorite }" >
<ion-icon name="share-alt" size="large" class="icon-share-alt" (click)="regularShare(i)"></ion-icon>
</ion-col>
</div>
Apparently if i comment the declaration on the construct the page will load otherwise it won't load