标签: angularfire

firebase注销方法有没有回调?

我正在查看这个文档:https: //www.firebase.com/docs/security/simple-login-overview.html并且基于它看起来不像logout不接受回调.我尝试传递一个并得到一个响应,它接受0个参数.有没有办法确认注销成功?

angularjs firebase angularfire

0
推荐指数
1
解决办法
472
查看次数

Firebase日期存储出错

所以我试图在Firebase中存储日期,如下所示:

 var fb = new Firebase(FIREBASE_URL);
        var syncData = $firebase(fb);
        var date = new Date(2014, 0, 1);
        console.log(date);
        syncData.$child('date').$set(date);
        var dateInFirebase = syncData.$child('date');
        dateInFirebase.$on('loaded', function(){
            console.log(dateInFirebase.$value);
        });
Run Code Online (Sandbox Code Playgroud)

第一个日期正确记录'Wed Jan 01 2014 00:00:00 GMT + 0100(CET)',但是第二个日志是:'2013-12-31T23:00:00.000Z',即1天前,是这个firebase中的一些bug还是我错过了一些明显的东西?我没有发现任何其他问题,所以我倾向于认为我做错了什么,我只是不知道是什么.

编辑:好的,现在我很困惑,如果我用空构造函数替换dateconstructor(今天的日期),他正确地存储日期..

javascript date firebase angularfire

0
推荐指数
1
解决办法
1641
查看次数

持久性Firebase OAuth身份验证

我正在尝试跨多个页面保持Firebase用户身份验证状态.

    $scope.loginGoogle = function() {
        console.log("Got into google login");
        ref.authWithOAuthPopup("google", function(error, authData) { 
           $scope.loggedIn = true;
           $scope.uniqueid = authData.google.displayName;
                 }, {
           remember: "sessionOnly",
           scope: "email"
        });
    };


        function checkLogin() {
           ref.onAuth(function(authData) {
             if (authData) {
                // user authenticated with Firebase
                console.log("User ID: " + authData.uid + ", Provider: " + authData.provider);
             } else {
               console.log("Nope, user is not logged in.");
             }
           });
        };
Run Code Online (Sandbox Code Playgroud)

但是,当在另一个页面中调用checkLogin函数时,即使用户已登录登录页面,也未定义authData.似乎是什么问题?

javascript angularjs firebase firebase-security angularfire

0
推荐指数
1
解决办法
856
查看次数

$ firebaseArray不是一个函数?

我正在创建一个firebase博客应用程序.我在TypeError: $firebaseArray is not a function 我的控制器中遇到问题,我在应用程序的整个范围内一直使用$ firebaseArray.我不知道我是怎么打破它的.我可以告诉你控制器的代码.

在此输入图像描述

 app.controller('postController',["$scope", "$location","$routeParams","Blog","FBURL","Auth","authDataSrvc", "$firebaseObject", "$firebaseArray","FilePicker", "$window", function($scope,$location,$routeParams,Blog,FBURL,$firebaseArray,$firebaseObject,FilePicker,$window,Auth,authDataSrvc){


$scope.posts = Blog.allPosts; //All blog posts
var postId = $routeParams.postId;

if(postId){
  $scope.selectedPost = getPost(postId); // gets unique object based on its id with get post function
}

function getPost(postId){
  var ref = new Firebase(FBURL + "/" + postId);
  return $firebaseArray(ref);
}


$scope.addPost = function(newpost){
  Blog.addPost($scope.newpost);
  $location.path('/'); //redirects to home page
  console.log(newpost);
  console.log($scope.posts); // all posts
  $scope.newpost ={}; //reset the message


};

$scope.currentPost = function(postId){
  Blog.getPost(postId); …
Run Code Online (Sandbox Code Playgroud)

angularjs firebase angularfire

0
推荐指数
1
解决办法
1430
查看次数

更优化的方式而不是从“firebase”导入 * 作为 firebase

import { AngularFireAuth } from '@angular/fire/auth';
import { AngularFirestore } from '@angular/fire/firestore';
constructor(
    private afAuth: AngularFireAuth,
    private afs: AngularFirestore,) {

  }
Run Code Online (Sandbox Code Playgroud)

用例 1:

createdDate: firebase.firestore.FieldValue.serverTimestamp(),
Run Code Online (Sandbox Code Playgroud)

用例 2:

 const result: firebase.auth.UserCredential = await this.afAuth.auth.signInWithCredential(credential);
Run Code Online (Sandbox Code Playgroud)

对于上面我需要导入这个:

import * as firebase from 'firebase';
Run Code Online (Sandbox Code Playgroud)

由于firebase是一个非常大的 JS 库,我想以更优化的方式进行。你能告诉我怎么做吗?

注意:这里我使用AngularFire. 但是我怎样才能得到这些模型呢?firebase.auth.UserCredential

firebase typescript angularfire angular google-cloud-firestore

0
推荐指数
1
解决办法
1157
查看次数

Firebase 用户验证电子邮件操作 URL 到自定义 URL

我正在使用 Angular 和 AngularFire 开发一个应用程序。当用户使用电子邮件和密码注册并且用户在其电子邮件中收到验证电子邮件时。当我将电子邮件地址验证模板中的操作 URL 更改为“ http://localhost:4200/verify-email-address ”时,用户的电子邮件验证仍然为 false,如果我使用默认 URL,则它将返回 true。如何设置自定义本地模板以向用户显示他/她的电子邮件已验证并重定向该用户以再次登录。

javascript firebase angularfire firebase-authentication

0
推荐指数
1
解决办法
3163
查看次数

错误 TS2344:类型“T[K]”不满足约束

我的 angular 应用程序有一个奇怪的问题,我刚刚将 AngularFire 添加到我的项目中,但是当我尝试将其安装时,它显示以下错误:

ERROR in nodae_modules/@angular/fire/angularfire2.d.ts(37,49): error TS2344: Type 'T[K]' does not satisfy the constraint '(...args: any[]) => any'.
node_modules/@angular/fire/angularfire2.d.ts(40,49): error TS2344: Type 'T[K]' does not satisfy the constraint '(...args: any[]) => any'.
node_modules/@angular/fire/angularfire2.d.ts(48,78): error TS2344: Type 'T[K]' does not satisfy the constraint '(...args: any[]) => any'.
node_modules/@angular/fire/angularfire2.d.ts(48,107): error TS2344: Type 'T[K]' does not satisfy the constraint '(...args: any[]) => any'.
node_modules/@angular/fire/angularfire2.d.ts(50,75): error TS2344: Type 'T[K]' does not satisfy the constraint '(...args: any[]) => any'.
node_modules/@angular/fire/angularfire2.d.ts(50,96): error TS2344: …
Run Code Online (Sandbox Code Playgroud)

typescript angularfire angularfire2 angular

0
推荐指数
3
解决办法
5773
查看次数

用户使用Angularjs和Firebase登录

我正在尝试使用Angularjs和Firebase创建一个简单的登录表单.我目前有一个简单的注册表单,它将userName添加到我的firebase数据库中.我需要知道的是,一旦在firebase系统中识别出userName,如何获得一个接受用户的登录页面,如果数据库中没有这样的userName,可能会产生回调错误.这是我的注册表格:

<html ng-app="myApp">
<body ng-controller="userCtrl">
    <div class="centerForm">

        <form>
          <div class="form-group">
            <label for="exampleInputUser">Username</label>
            <input type="username" ng-model="userName" class="form-control" id="exampleInputUser" placeholder="username">
          </div>
          <div class="form-group">
            <label for="exampleInputPassword1">Password</label>
            <input type="password" ng-model="userPassword" class="form-control" id="exampleInputPassword1" placeholder="Password">
          </div>
          <table class="nav" align="center">
            <tr>
                <td>
                    <p><button type="submit" class="btn btn-primary" ng-click="saveUser()">Submit</button>
                    <a href="#" class="btn btn-info" role="button">Sign Up</a></p>
                </td>
            </tr>       
          </table>
        </form>

    </div>  
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

这是我的注册码:

 <script>
             angular.module('myApp', [])
             .controller('userCtrl', function($scope) {
                $scope.userName ="";
                $scope.userPassword="";

                $scope.myData = new Firebase( "https://myfirebaseapp.firebaseio.com/")

                $scope.saveUser = function() {
                    $scope.myData.push({userName: $scope.userName});
                };

                });





    </script> 
Run Code Online (Sandbox Code Playgroud)

我的登录表单看起来像:

<html ng-app="myApp"> …
Run Code Online (Sandbox Code Playgroud)

angularjs firebase angularfire

-1
推荐指数
1
解决办法
7330
查看次数