@zionnite wrote:
hello all,
i have a code to display my information after i logged into firebase but it only out putted on the console log, thats not what i want i want to display the data in my ionic list view.here is my controller code:
app.controller('LoginCtrl', function($scope, $state, $ionicPopup, $firebaseAuth, $firebaseArray, $firebaseObject){
$scope.formData = {
"email": "",
"password": ""
};
$scope.currentUserName ={};
$scope.currentUserImg ={};
var fb = new Firebase("https://bigzill.firebaseio.com/");var fbAuth = $firebaseAuth(fb); $scope.login = function(email, password){ if(email && password){ console.log("valid Form"); fbAuth.$authWithPassword({ email: email, password: password }).then(function(authData){ var authData = fb.getAuth(); var usersRef2 = new Firebase("https://bigzill.firebaseio.com/users/"+authData.uid); usersRef2.on("value", function(snapshot) { $scope.data = snapshot.val(); // data equals { "name": { "first": "Fred", "last": "Flintstone" }, "age": 53 } //console.log($scope.data.username); // "Fred" //console.log($scope.data.image_name); // 53 var SnapshotcurrentUserName =snapshot.child("username"); $scope.currentUserName = SnapshotcurrentUserName.val(); console.log($scope.currentUserName); var SnapshotcurrentUserImg =snapshot.child("image_name"); $scope.currentUserImg = SnapshotcurrentUserImg.val(); console.log($scope.currentUserImg); }); $state.go('tab.home'); }).catch(function(error){ console.log("Error: " + error); $ionicPopup.alert({ title: "Login Error", template: error }); }); }else{ console.log("Invalid Form"); } }
});
HERE IS MY VIEW CODE:
![]()
{{currentUserName.username}}
helloe fine it
Please what am i doing wrong
Posts: 1
Participants: 1