cordova not defined for file opener2

461 Views Asked by At

I have been trying to open pdf on an ionic app using file opener2 Cordova plugin but it's not working and is showing errors with Cordova not defined(but Id id inject the ngCordova module at app.js

    $scope.gotoPDF1 = function () {
      cordova.plugins.fileOpener2.open(
        'pdf/main.pdf',
        'application/pdf', {
          error: function (e) {
            console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
          },
          success: function () {
            console.log('file opened successfully');
          }
        }
      );
    }
        <div class="col col-60" style="margin-left:8%" ng-click="gotoPDF1()">

0

There are 0 best solutions below