JSFiddle - React, Tailwind, and code Playground
by Nicolas PUJOL
HTML
<div ng-app="app">
<ul class="nav navbar-nav">
<li ng-show="!authenticated"><a href="/users/register">JOIN</a></li>
<li ng-show="!authenticated"><a href="/users/login">Login</a></li>
<li ng-show="authenticated"><a href="/users/profile">ME</a></li>
<li ng-show="authenticated" onclick="signOut();"><a>Logout</a></li>
</ul>
</div>
JavaScript
firebase.auth().onAuthStateChanged(function(user) {
console.log("CURRENT USER:" + firebase.auth().currentUser);
if (user) {
app.controller('ctrl', function($rootScope, $window) {
$scope.user = $window.user;
$rootScope.authenticated = $scope.user;
$rootScope.$apply();
setAppCookie();
// Compile the whole <body> with the angular module named "app"
angular.bootstrap(document.body, ['app']);
});
}
});