Cordova Plug-ins Not NGCordova

What am I doing wrong? I have tried multiple Cordova plug-ins (adding them with CLI), I have Weinre Running and can call the plugin JS code sucessfully. But if I try the same exact code in a Ionic Controller or Factory it has no idea that the plugin JS object exists.

For Example: Take cordova-screenshot plugin: https://github.com/gitawego/cordova-screenshot

Added via

ionic plugin add https://github.com/gitawego/cordova-screenshot.git

When I launch the app in GenyMotion (Android 4.4) - I can run the following in my Weinre JS Console

navigator.screenshot.save(function(error,res){
  if(error){
    console.error(error);
  }else{
    console.log('ok',res.filePath);
  }
});

image

But when I run the same JS in my controller:

.controller('StatusCtrl', function($scope, $ionicPopup, $timeout, Schedules,Light) {
 navigator.screenshot.save(function(error,res){
  if(error){
    console.error(error);
  }else{
    console.log('ok',res.filePath);
  }
});

It gives me a JS error:

file:///android_asset/www/lib/ionic/js/ionic.bundle.js: Line 17696 : TypeError: Cannot call method 'save' of undefined

I have tried this with other cordova-plug-ins like ( https://github.com/Tlantic/cdv-socket-plugin) and experience the same thing. What am I missing? Do I need to use some fully qualified class name or is this a config item? Why does it work in Weinre and not in Ionic?

I’m having an issue with this as well. Have you found a solution yet?

This is the error I get when using navigator.screenshot.save in a controller or a service:

[phonegap] [console.error] Error: undefined is not an object (evaluating ‘navigator.screenshot.save’)