I have a slight bug in my app that it always shows the login page briefly before it moves on to my other pages, specifically my admin page, the only page that I need to access with my login authentication. I am using AngularJS, Yeoman stack with Firebase, AngularFire database. I downloaded the simpleLoginTool and the authentication using: https://github.com/firebase/generator-angularfire.

Here is my routes in app.js

angular
  .module('myApp', [
    'ngAnimate',
    'ngCookies',
    'ngResource',
    'ngRoute',
    'ngSanitize',
    'ngTouch',
    'firebase',
    'angularfire.firebase',
    'angularfire.login',
    'simpleLoginTools'
  ])
  .config(function ($routeProvider) {
    $routeProvider
      .when('/', {
        templateUrl: 'views/main.html',
        controller: 'MainController'
      })
      .when('/admin', {
        authRequired: true,
        templateUrl: 'views/admin.html',
        controller: 'MainController'
      })
      .when('/login', {
        authRequired: false, // if true, must log in before viewing this page
        templateUrl: 'views/login.html',
        controller: 'LoginController'
      })
      .otherwise({
        redirectTo: '/'
      });
  });
0

There are 0 best solutions below