我正在使用Ionic + Cordova移动应用程序登录Google。 我的app.js
var app = angular.module('starter', ['ionic', 'starter.controllers','starter.services','ngSanitize', 'ngCordova', 'ngCordovaOauth', 'facebook'])
我的控制器
.controller('login',['$scope','myService','$location','$state','$timeout',function($scope,myService,$location,$state,$timeout, $http, $cordovaOauth)
{
$scope.googleLogin = function(){
$cordovaOauth.google("640286280543-pgr2pqnk0clc7qmobsvgkuno2fin7opd.apps.googleusercontent.com", ["email","profile"]).then(function(result) {
$scope.showProfile = false;
$http.get("https://www.googleapis.com/plus/v1/people/me", {params: {access_token: result.access_token }})
.then(function(res) {
$scope.showProfile = true;
$scope.details = res.data;
console.log(res.data)
}, function(error) {
alert("Error: " + error);
});
},function(error) {
// error
$scope.details = 'got error';
})
}
}]) followed this Tutorial. Click me!
我的错误:
错误:$ cordovaOauth未定义 $ scope.googleLogin @ http://localhost:8100/js/controllers.js:53:3