AngularJS: How to hide the template content until user is authenticated?
问题 My app has 2 pages: main.html and login.html . When not authenticated users go to /main they should be redirected to /login . The problem is that main.html is rendered first, and after a second or so, when user authentication fails, login.html is rendered. How could I prevent from main.html to be rendered until authentication succeeds? Here is the relevant code (CoffeeScript): angular.module('myApp', [...]) .config(['$routeProvider', ($routeProvider) -> $routeProvider.when '/login',