簡體   English   中英

TypeError:無法使用AngularJs讀取IONIC中未定義的屬性'googleplus'

[英]TypeError: Cannot read property 'googleplus' of undefined in IONIC with AngularJs

我一直在關注這些鏈接,在我的混合應用程序中使用社交登錄。

https://github.com/EddyVerbruggen/cordova-plugin-googleplus

https://ionicthemes.com/tutorials/about/google-plus-login-with-ionic-framework

我創建了所有谷歌開發者ID和所有這些東西。 正如他們所說,我已經使用這兩個安裝了cordova-plugin-googleplus。 但仍然我的應用程序顯示我提到的錯誤作為此消息的標題...

在這一行:window.plugins.googleplus.login(

所以,請幫助我這個...我已經堅持這2天了...任何幫助將不勝感激。

下面是$ionicPlatform.ready()函數包裝器中的cordova插件檢查示例:

mainApp.run(["$ionicPlatform", "$window", function ($ionicPlatform, $window) {

    $ionicPlatform.ready(function () {
        if ($window.plugins && $window.plugins.googleplus) {
            $window.plugins.googleplus.isAvailable(
                function (available) {
                if (available) {
                    // show the Google+ sign-in button
                }
            });
        }
    ...

    }

PS: $window是一個角包裝window

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM