Hi how can i bind data that i received from firebase with scope in angularJS. I am new to this and following though w3school. So i am not sure what i am missing. I am using
"angular": "^1.7.2",
"angular-route": "^1.7.2",
"firebase": "^5.2.0",
And my code is like this
app.config(function($routeProvider){
$routeProvider
.when('/',{
templateUrl:'home.html',
controller:'UserController'
})
})
app.controller("UserController", function ($scope, $routeParams, $location) {
firebaseRef.child('users').on("value", function(response) {
$scope.userCount=response.numChildren();
});
})
And in html i am doing like this
<html lang="en" ng-app="my-first-app">
............<HEADER AND TITLE AND BODY>......
<h3>User count : {{userCount}} </h3>
</body>
</html>
But nothing is coming even though if I console.log the value of response.numChildren() I see 4.
Can anyone please tell me where I'm doing wrong?