Last active
August 29, 2015 14:19
-
-
Save carmichaelize/addbb19ba60fe2435733 to your computer and use it in GitHub Desktop.
Boot Angular app after Firebase auth.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular | |
.module('myApp') | |
.run(function(){ | |
//The app is initialised. | |
}); | |
//Get Firebase auth | |
var ref = new Firebase('https://<!--FIREBASEURL-->.com'), | |
auth = ref.getAuth(); | |
//Check Firebase auth | |
if (auth) { | |
ref.child(auth.uid).once('value',function(data){ | |
//Boot app after user data is available | |
angular.element(document).ready(function() { | |
angular.bootstrap(document, ['myApp']); | |
}); | |
}); | |
} else { | |
//Boot app | |
angular.element(document).ready(function() { | |
angular.bootstrap(document, ['myApp']); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment