0
嘿傢伙完成noob角。你可以幫我嗎? 所以我有谷歌的OAuth提供以下代碼:如何將index.html中的變量傳遞給服務?
<script>
function onSignIn(googleUser) {
// Useful data for your client-side scripts:
var profile = googleUser.getBasicProfile();
console.log("ID: " + profile.getId()); // Don't send this directly to your server!
console.log("Name: " + profile.getName());
console.log("Image URL: " + profile.getImageUrl());
console.log("Email: " + profile.getEmail());
// The ID token you need to pass to your backend:
var id_token = googleUser.getAuthResponse().id_token;
console.log("ID Token: " + id_token);
};
</script>
這是index.html的
我希望能夠從一個工廠,我在角訪問給定的令牌。這是通過$範圍?
App.factory('ranService', ['$http', '$q', function ($http, $q) {
var service = {};
var randomUrl = "http://zzz;
var googleToken;
return service
}]);
感謝
你能向我們展示角服務? –
@Beto。檢查我的答案。如果它沒有幫助,請告訴我 –