(function() {

    'use strict';

    angular.module('Core')
        .service('firebaseService', firebaseService);

    firebaseService.$inject = [];

    function firebaseService('commonService') {
        var service = this;
        service.getFirebaseRef = getFirebaseRef;

        /* ======================================== Var ==================================================== */
        var firebaseUrl = 'https://stadium-booking.firebaseio.com/';

        /* ======================================== Services =============================================== */
        var cmnSvc = commonService;

        /* ======================================== Public Methods ========================================= */
        function createUserProfile(userData) {

        }

        function createSimpleLoginUser(userData) {
            var deferred = cmnSvc.$q.defer();

            getFirebaseRef().then(function(rs) {
                rs.createUser({
                    email: userData.emailAdd,
                    password: userData.password
                }, function(error, userVal) {
                    if (error) {
                        deferred.reject(error);
                    } else {
                        userData.uid = userVal.uid;
                        createUserProfile(userData);
                        simpleLogin(userData);
                    }
                });
            })

            return deferred.promise;
        }

        function simpleLogin(userData) {
            getFirebaseRef().then(function(rs) {
                rs.authWithPassword({
                    email: userData.emailAdd,
                    password: userData.password
                }, function(error, authData) {
                    if (error) {
                        deferred.reject(error);
                    } else {
                        getUserProfile(authData);
                    }
                }, {
                    remember: "sessionOnly"
                });
            })
        }

        function getFirebaseRef(path) {
            var deferred = cmnSvc.$q.defer();

            if (path == undefined || path == null || path.length <= 0) {
                deferred.resolve(new Firebase(firebaseUrl));
            } else {
                deferred.resolve(new Firebase(firebaseUrl + path));
            }

            return deferred.promise;
        }
        /* ======================================== Private Methods ======================================== */
        function init() {

        }

        init();
    }
})();

@@ -717,67 +717,8 @@
  */%0A
-        function createUserProfile(userData) %7B%0A%0A        %7D%0A%0A
     
@@ -756,32 +756,32 @@
 ser(userData) %7B%0A
+
             var 
@@ -1237,34 +1237,57 @@
 rofile(userData)
-;%0A
+.then(function(rs) %7B%0A    
                 
@@ -1313,24 +1313,121 @@
 (userData);%0A
+                        %7D, function (err)%7B%0A%0A                        %7D);%0A                        %0A
             
@@ -1553,32 +1553,79 @@
 gin(userData) %7B%0A
+            var deferred = cmnSvc.$q.defer();%0A%0A
             getF
@@ -2117,16 +2117,55 @@
       %7D)
+;%0A%0A            return deferred.promise;
 %0A       
@@ -2532,32 +2532,32 @@
 mise;%0A        %7D%0A
-
         /* =====
@@ -2644,32 +2644,595 @@
 ============ */%0A
+        function createUserProfile(userData) %7B%0A            var deferred = cmnSvc.$q.defer();%0A%0A            getFirebaseRef('users/' + userData.uid).then(function(rs) %7B%0A                rs.set(%7B%0A                    emailAdd: userData.emailAdd%0A                %7D, function(error) %7B%0A                    if (error) %7B%0A                        deferred.reject(error);%0A                    %7D else %7B%0A                        deferred.resolve('user created successfully');%0A                    %7D%0A                %7D);%0A            %7D)%0A%0A            return deferred.promise;%0A        %7D%0A%0A
         function

Add create user profile