小编Ran*_*ano的帖子

将Firebase SDK 3与Ionic 1.X配合使用

我正在离子1.X中建立聊天,我想使用Firebase作为我的数据库和auth提供者.首先,我希望能够使用Firebase创建和登录用户.我在帐户中启用了简单的电子邮件和密码验证.然而,大多数的教程这样一个与火力地堡2.作品如果我跟着它,我有一个错误:

在我的index.html中,我加载了firebase,如:

<script src="https://cdn.firebase.com/js/client/2.2.4/firebase.js"></script>
<!-- AngularFire -->
<script src="https://cdn.firebase.com/libs/angularfire/1.2.0/angularfire.min.js"></script>
Run Code Online (Sandbox Code Playgroud)

并创建用户:

  $scope.signupEmail = function(){
    $scope.message = null;
    $scope.error = null;

    console.log('In signup email with username ' +  $scope.data.username + ' email ' + $scope.data.email + ' and password ' + $scope.data.password);
    var chatRef = new Firebase('https://some-url.firebaseio.com');
    var auth = $firebaseAuth(chatRef);
    auth.$createUser({
      email: $scope.data.email,
      password: $scope.data.password
    }).then(function(userData) {
        console.log("User created with uid: " + userData.uid);
        $scope.message = "User created with uid: " + userData.uid;
      }).catch(function(error) {
        console.log("Error: " + error); …
Run Code Online (Sandbox Code Playgroud)

firebase ionic-framework firebase-authentication firebase-realtime-database

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