简体   繁体   中英

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

I've been following these links to use social login in my hybrid app.

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

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

I've created all the google developer id's and all that stuff. I've installed the cordova-plugin-googleplus using those two as they said. But still my application showing the error i mentioned as header of this message...

In this line: window.plugins.googleplus.login(

So, please help me with this one... I've stuck on this for 2 dayzz...Any help will be appreciated.

Here below is an example of cordova plugins check in the $ionicPlatform.ready() function wrapper:

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 is an Angular wrapper for window

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM