Why this code cannot connect with firebase

angularjs
apps
project
firebase

#1

I want to connect my code with my firebase. actually i want to upload the image at the firebase, but it seem like, the button cannot connect with the firebase. Please help me to solve this problem. I'm a beginner programmer. TQ..

this is my app.js code.

var imageApp=angular.module('starter', ['ionic','ngCordova','firebase']);
var fb=new Firebase("https://popping-heat-5867.firebaseio.com/");

imageApp.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
});

imageApp.config(function($stateProvider, $urlRouterProvider){
$stateProvider
.state('firebase',{
url:'/firebase',
templateUrl:'templates/firebase.html',
controller: "FirebaseController",
cache:false
})
.state('secure',{
url:'/secure',
templateUrl:'templates/secure.html',
controller: "SecureController",

});
$urlRouterProvider.otherwise("/firebase");
});

imageApp.controller("FirebaseController",function($scope,$state,$firebaseAuth){
var fbAuth=$firebaseAuth(fb);

$scope.login=function(username,password){
fbAuth.$authWithPassword({
email:username,
password:password
}).then(function(authData){
$state.go('secure');
}).catch(function(error){
console.error("ERROR: "+error);
});
}
$scope.register=function(username,password){
fbAuth.$createUser({email:username,password: password}).then(function(userData){

  return fbAuth.$authWithPassword({
     email:username,
  password:password
});
 
}).then(function(authData){
  $state.go('secure');
}).catch(function(error){
  console.error("ERROR: "+error);
});

}
};

imageApp.controller("SecureController",function($scope,$ionicHistory,$firebaseArray,$cordovaCamera){
$ionicHistory.clearHistory();
$scope.images=[];
var fbAuth=fb.getAuth();
if(fbAuth){
var userReference=fb.child("users/"+fbAuth.uid);
var syncArray=$firebaseArray(userReference.child("images"));
$scope.images=syncArray;
}else{
$state.go('firebase');
}
$scope.upload=function(){
var options={
quality:75,
destinationType:Camera.DestinationType.DATA_URL,
sourceType:Camera.PictureSourceType.CAMERA,
allowEdit:true,
encodingType:Camera.EncodingType.JPEG,
popoverOptions:CameraPopoverOptions,
targetWidth:500,
targetHeight:500,
saveToPhotoAlbum:false
};
$cordovaCamera.getPicture(options).then(function(imageData){
syncArray.$add({image: imageData}).then(function(){
alert("the image was saved");
});
},function(error){
console.error("ERROR: "+error);
});
};
});