title: Add Cordova Diagnostic Plugin in Ionic?
body: <p>I'm new in ionic and I want to use Corodova Diagnostic plugin in my ionic project. I don't know how to use plugins in ionic. I've added this plugin using this command.</p>
  
  <pre><code> $ cordova plugin add cordova.plugins.diagnostic
  </code></pre>
  
  <p>I can see this plugin in my list using </p>
  
  <pre><code> $ cordova plugins ls
  </code></pre>
  
  <p>now i have a seperate controller file, i am post its code here, when i try to use this , it give error, cordova is</p>
  
  <pre><code> angular.module('timetools_controllers', ['ui.utils', 'ionic','cordovaGeolocationModule'])
  
  .controller('TimetoolsCtrl', ['$scope', '$http', '$localstorage', '$ionicPopup', function ($scope, $http, $localstorage, $ionicPopup) {
  
      /*=================================================================================*/
      // ABFRAGE OB TRACK &amp; SHARE AKTIV IST
      /*=================================================================================*/
      var fdappAuth = $localstorage.getObject('fdappAuth');
  
      $http({
          method: 'GET',
          url: 'http://app.flugdeck.com/options.php?apikey=7ksmewzSUd2asSA0384cosb!2w3SloE&amp;do=get&amp;optid=110&amp;userId=' + fdappAuth.fdappUserId + '&amp;userPwHash=' + fdappAuth.fdappUserPw,
          headers: {
              'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
          }
      })
          .success(function (data, status) {
              // Verarbeitet die Daten und setzt diese zur Anzeige in die scopes
              console.log("Optionsabfrage für Track &amp; Share läuft");
  
              $scope.optentry = data[0];
              $scope.optentry.opt_110 = data[0].opt_110;
  
              if ($scope.optentry.opt_110 == 1) {
                  $scope.isTrackShareActive = "Tracking ";
                  $scope.cssClass = "Tracking";
              } else {
                  $scope.isTrackShareActive = "Tracking ";
                  $scope.cssClass = "Tracking";
              }
          });
  
  
      $scope.saveOffBlockTime = function () {
          var datum = new Date();
          console.log("Datums-String: " + datum);
  
          // Erstelle das Datum und Poste das
          if ($scope.OffBlockRunAlready === true) {
  
          } else {
              // Setzt das Datum
              $scope.OffBlockTime = datum;
  
  
              $scope.OffBlockRunAlready = true;
  
              if ($scope.optentry.opt_110 == 1) {
                  /***********************/
                  // GPS TEST CODE CORDOVA
                  /***********************/
                  alert("GPS TEST");
                   cordova.plugins.diagnostic.isLocationEnabled(function(enabled){
                      console.log("Location is " + (enabled ? "enabled" : "disabled"));
                  }, function(error){
                      console.error("The following error occurred: "+error);
                  });
  
  
  
              }
  
          }
      }; // saveOffBlockTime
  
  
  
  
  
  
  
  
  }]) ;// Ende .controller('TimetoolsCtrl'...
  </code></pre>
  
  <p>but it give following error in console.</p>
  
  <pre><code> ReferenceError: cordova is not defined
  </code></pre>
  
  <p>Can anybody help me please?</p>
  
  <p>my Index.html</p>
  
  <pre><code> &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"&gt;
  &lt;title&gt;&lt;/title&gt;
  
  &lt;!-- build:css dist_css/styles.css --&gt;
  &lt;link href="css/ionic.app.css" rel="stylesheet"&gt;
  &lt;link href="css/style.css" rel="stylesheet"&gt;
  &lt;!-- endbuild --&gt;
  
  &lt;script src="http://maps.google.com/maps/api/js"&gt;&lt;/script&gt;
  &lt;!-- build:js dist_js/modules.js --&gt;
  &lt;script src="lib/ionic/js/ionic.bundle.js"&gt;&lt;/script&gt;
  &lt;script src="lib/underscore/underscore-min.js"&gt;&lt;/script&gt;
  &lt;script src="lib/ngmap/build/scripts/ng-map.min.js"&gt;&lt;/script&gt;
  &lt;script src="lib/moment/min/moment.min.js"&gt;&lt;/script&gt;
  &lt;script src="lib/angular-moment/angular-moment.min.js"&gt;&lt;/script&gt;
  &lt;script src="lib/angular-md5/angular-md5.min.js"&gt;&lt;/script&gt;
  &lt;script src="lib/angular-base64/angular-base64.min.js"&gt;&lt;/script&gt;
  &lt;script src="lib/angular-cordova-geolocation/cordovaGeolocationModule.js"&gt;      &lt;/script&gt;
  &lt;script src="lib/ngCordova/dist/ng-cordova.min.js"&gt;&lt;/script&gt;
  &lt;!-- endbuild --&gt;
  &lt;!-- cordova script (this will be a 404 during development) --&gt;
  &lt;script src="cordova.js"&gt;&lt;/script&gt;
  
  &lt;!-- build:js dist_js/app.js --&gt;
  &lt;script src="dist/dist_js/app/app.js"&gt;&lt;/script&gt;
  &lt;script src="dist/dist_js/app/directives.js"&gt;&lt;/script&gt;
  &lt;script src="dist/dist_js/app/controllers.js"&gt;&lt;/script&gt;
  &lt;script src="dist/dist_js/app/templates.js"&gt;&lt;/script&gt;
  &lt;script src="dist/dist_js/app/services.js"&gt;&lt;/script&gt;
  &lt;script src="dist/dist_js/app/config.js"&gt;&lt;/script&gt;
  &lt;script src="dist/dist_js/app/filters.js"&gt;&lt;/script&gt;
  &lt;script src="js/mymodules.js"&gt;&lt;/script&gt;
  &lt;script src="lib/ui-utils.min.js"&gt;&lt;/script&gt;
  &lt;script src="js/controller_flightlog.js"&gt;&lt;/script&gt;
  &lt;script src="js/controller_timetools.js"&gt;&lt;/script&gt;
  &lt;script src="js/controller_infotools.js"&gt;&lt;/script&gt;
  &lt;script src="dist/dist_js/app/factories.js"&gt;&lt;/script&gt;
  &lt;!-- endbuild --&gt;
  &lt;/head&gt;
  
  &lt;body ng-app="your_app_name"&gt;
  &lt;ion-nav-view&gt;&lt;/ion-nav-view&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>