Skip to content

Instantly share code, notes, and snippets.

@carmichaelize
Last active August 29, 2015 14:19
Show Gist options
  • Save carmichaelize/addbb19ba60fe2435733 to your computer and use it in GitHub Desktop.
Save carmichaelize/addbb19ba60fe2435733 to your computer and use it in GitHub Desktop.
Boot Angular app after Firebase auth.
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