Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70904

How to refer cordova plugins in $ionicplatform.ready?

$
0
0

@krishnanspace wrote:

So I have added the cordovaarduino plugin using cordova plugin add cordovaarduino and it resides in the plugins directory.

The project root directory

The www directory.

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title></title>

    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
    <link href="css/ionic.app.css" rel="stylesheet">
    -->

    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <!--<script src="cordova.js"></script>-->

    <!-- your app's js -->
    <script src="js/app.js"></script>
  </head>
  <body ng-app="starter" ng-controller="hostController">
  <div class="offline-outer-wrap">
    <h2>Bahmni Setup</h2>
    <div class="offline-wrap">
      <p>Please provide Bahmni instance's IP or hostname to continue with setup</p>
      ....
    </div>
  </div>
  </body>
</html>

app.js

app.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if(window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    }
    if(window.StatusBar) {
      StatusBar.styleDefault();
    }

    if(window.localStorage['host']){
      window.open('file:///android_asset/www/app/offline/index.html#device/android','_self')
    }
  });
});

In the $ionicplatform.ready() , window.cordova is not available nor am I able to access my plugin using the navigator object.

How can I access the plugin and what am I doing wrong?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70904

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>