title: Spring Security + Angularjs redirect after login
body: <p>Trying to use idea from this tutorial: <a href="https://spring.io/guides/tutorials/spring-security-and-angular-js/" rel="nofollow">https://spring.io/guides/tutorials/spring-security-and-angular-js/</a></p>
  
  <pre><code>    @Override
      protected void configure(HttpSecurity http) throws Exception {
          http.formLogin().and()
              .logout().and().authorizeRequests()
              .antMatchers("/index.html", "/main.html", "admin.html",  
              "/login.html", "/")         
              .permitAll().anyRequest()
              .authenticated().and().csrf().disable();
      }
  </code></pre>
  
  <p>Also I use angularjs ngRoute:</p>
  
  <pre><code>var myApp = angular.module('myApp',['ngRoute']);
  
  myApp.config(['$routeProvider',
      function($routeProvider) {
        $routeProvider
          .when('/', {
            templateUrl: 'main.html',
                controller: 'MainController'
          })
          .when('/admin', {
            templateUrl: 'admin.html',
                controller: 'AdminController'
          })
          .when('/login', {
            templateUrl: 'login.html',
            controller: 'LoginController'
          })
          .otherwise({
              redirectTo: '/'
          });
  }]);
  </code></pre>
  
  <p>And so on. </p>
  
  <p>But when I try to open admin page (for example /#/admin) it opens login form (from the box) and after that I expect that <strong>it should redirect me</strong> back to /#/admin, <strong>but it redirect me</strong> to /admin.html, which is out of the angular control.</p>
  
  <p>How to solve this?</p>