Window.plugins is undefined in ngcordova


I am using the cordova social share plugin in my app. Whenever I click on the share button (I’m calling shareAnywhere() on ng-click I get TypeError: Cannot read property 'socialsharing' of undefined and it occurs on line 6238 of ngcordova.js which is the following line:

$window.plugins.socialsharing.share(message, subject, file, link, function () {

Why is window.plugins undefined?

Are you testing in a browser or on an actual device?

Both. On browser I get the error message in console. On my Android device nothing happens when I click on the share button.

Plugins will never work in the browser, so that error message is normal.

The fact that nothing happens on your device must mean you’ve done something wrong. Debug and check your code to see if everything is correct

1 Like

use this and then check, ionic state restore

Hi Same issue is there with me. its not working.