nraboy / ng-cordova-oauth

AngularJS oauth library for use with Apache Cordova projects
https://www.thepolyglotdeveloper.com
MIT License
456 stars 199 forks source link

Cannot read property 'facebook' of undefined #303

Closed AzrizHaziq closed 7 years ago

AzrizHaziq commented 7 years ago
screen shot 2016-11-09 at 10 24 32 am

Im using Ionic 1 with angular, I don't know why Facebook method is undefined

here my piece of code

$cordovaOauth.facebook("myAppID", [
  "email",
  "user_website",
  "user_location",
  "user_relationships"
])
.then(function(result) {
  console.log(result);
}, function(error) {
  console.log(error);
});

I already have inject the '$cordovaOauth'``, and include the'ngCordovaOauth'``` in module

and when i try to console.log($cordovaOauth); the output is below.

screen shot 2016-11-09 at 10 30 08 am

where goes all the google, facebook, etc method?

Thank you (edit: update styling)

AzrizHaziq commented 7 years ago

So so sorry, it happen that i miss my inject modules.

Before:

    angular
      .module('app.auth')
      .controller('AuthController', AuthController);

    AuthController.$inject = [
      '$scope',
      '$state',
      'ionicToast',
      '$cordovaOauth',
      '$q'
    ];

    function AuthController($scope, $state, $cordovaOauth,$q){ ... }

After:

    angular
      .module('app.auth')
      .controller('AuthController', AuthController);

    AuthController.$inject = [
      '$scope',
      '$state',
      'ionicToast',
      '$cordovaOauth',
      '$q'
    ];

    function AuthController($scope, $state, ionicToast, $cordovaOauth,$q){ ... }