不获取/插入数据

时间:2016-09-25 17:41:15

标签: angularjs firebase firebase-realtime-database angularfire

它不会从Firebase和Angular接收数据不起作用。 Firebase数据库的结构:

mainBranch
   -> achild : "good"

这些代码有什么问题?

<html lang="en">
<head>
    <meta charset="UTF-8">
    <!-- Angular -->
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>

    <!-- Firebase -->
    <script src="https://www.gstatic.com/firebasejs/3.4.0/firebase.js"></script>
    <script>
      // Initialize Firebase
      firebase.initializeApp(config);
    </script>

    <!-- AngularFire -->
    <script src="https://cdn.firebase.com/libs/angularfire/1.2.0/angularfire.min.js"></script>
    <script>
        var app = angular.module("app",["firebase"]);
        app.controller("myController",["$scope","$firebaseObject",function($scope,$firebaseObject){

            const rootRef = firebase.database().ref().child("mainBranch");
            this.object = $firebaseObject(rootRef);

        }]);
    </script>
</head>
<body>

</body>
</html>

0 个答案:

没有答案