title: Using Cordova Plugins in Ionic Inside a Controller
body: <p>So I am trying to integrate touch authentication into my app. I took a look at this article <a href="http://ourcodeworld.com/articles/read/190/how-to-use-fingerprint-authentication-in-cordova-phonegap-ionic-for-android-and-ios" rel="nofollow noreferrer">http://ourcodeworld.com/articles/read/190/how-to-use-fingerprint-authentication-in-cordova-phonegap-ionic-for-android-and-ios</a> and it looked like exactly what I wanted. It used this <a href="https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth.git" rel="nofollow noreferrer">https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth.git</a> and <a href="https://github.com/EddyVerbruggen/cordova-plugin-touch-id" rel="nofollow noreferrer">https://github.com/EddyVerbruggen/cordova-plugin-touch-id</a> plugin.</p>
  
  <p>Now this is when you find out I'm a newb with Angular and Ionic. How do I pass those functions into the controller, so that I can have something like this:</p>
  
  <pre><code>.controller('LoginController', function ($rootScope, $scope, $touchAuth) {
      $touchAuth.isAvailable(
      function() {
          alert('available!')
      }, // success handler: TouchID available
      function(msg) {
          alert('not available, message: ' + msg)
      } // error handler: no TouchID available
  
      $touchAuth.verifyFingerprint(
      'Scan your fingerprint please', // this will be shown in the native scanner popup
      function(msg) {
          alert('ok: ' + msg);
      }, // success handler: fingerprint accepted
      function(msg) {
          alert('Something is wrong: ' + JSON.stringify(msg));
      } // error handler with errorcode and localised reason
  })
  </code></pre>
  
  <p>Basically what I want to know is how can I use these functions these plugins provide within my controllers?</p>