AngularJS error: TypeError: v2.login is not a function

前端 未结 8 930
暖寄归人
暖寄归人 2021-01-17 07:49

I would like to call the login function when I click the login button but keep getting the error message in the title. Can someone point out the error in my script?

8条回答
  •  一整个雨季
    2021-01-17 08:15

    Two enable two-way binding you have to assign your login function to $scope. Replace your code for function with this:

    $scope.login=function() {
            ref.authWithPassword({
                email    : "nick.koulias@gmail.com",
                password : "Jaeger01"
            }, function (error, authData) {
                if (error) {
                    console.log("Login Failed!", error);
                } else {
                    console.log("Authenticated successfully with payload:", authData);
                }
            });
        }
    

提交回复
热议问题