1

I am using the UI-router library with Spring Boot and Spring Security. When I try to access a route I have defined, nothing happens, I don't even get an error in the console.

Here is my app.js file

var app = angular.module("app", ['ui.router']);

app.config(function($stateProvider, $urlRouterProvider) {
//
// For any unmatched url, redirect to /state1
$urlRouterProvider.otherwise("/");
//
// Now set up the states
$stateProvider
    .state('default', {
        url: "/",
        templateUrl: "partials/firstpage.html"
    })

.state('register', {
    url: "/register",
    templateUrl: "partials/register.html"
})

.state('login', {
    url: "/login",
    templateUrl: "partials/login.html"
})

});

The index.html file:

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">

<script src="assets/js/jquery-2.1.4.js"></script>

<script src="assets/bootstrap/js/bootstrap.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"> </script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.3.1/angular-ui-router.js"> </script>

<script src="app.js"> </script>
<script src="controllers/navbar.controller.js"> </script>

</head>

<body>
<div ui-view> </div>

</body>

The WebSecurityConfiguration class:

protected void configure(HttpSecurity httpSecurity) throws Exception {
    httpSecurity
            .csrf()
            .disable()
            .exceptionHandling()
            .authenticationEntryPoint(authenticationEntryPoint)
            .and()
            .sessionManagement()
            .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
            .and()
            .authorizeRequests()
            .antMatchers(
                    HttpMethod.GET,
                    "/",
                    "/*.html",
                    "/favicon.ico",
                    "/**/*.html",
                    "/**/*.css",
                    "/**/*.js",
                    "/**/**/*.css",
                    "/**/**/*.js",
                    "/**/**/*.html",
                    "/**/**/**/*.css",
                    "/**/**/**/*.js",
                    "/**/**/**/*.html",
                    "/**/**/**/**/*.css",
                    "/**/**/**/**/*.js"          
            ).permitAll()
            .antMatchers("/auth/**", "/").permitAll()
            .anyRequest().authenticated();

    // Custom JWT based authentication
    httpSecurity
            .addFilterBefore(authenticationTokenFilterBean(), UsernamePasswordAuthenticationFilter.class);
}

And here is my project structure: project structure

Is there anything that I should add to my code to configure the ui-router library for Spring boot?

1
  • <html lang="en" ng-app="app"> Commented Jan 25, 2017 at 10:15

1 Answer 1

0

Your HTML code doesn't have an ng-app directive. So basically your angular app is not getting initalized

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.