1

I'm making a tutorial mixing AngularJS and Spring Boot that run on a Tomcat server and I'm trying to make a route work but it just doesn't seem to be doing anything. Do you guys see anything wrong here? I've done angular routing before but had no trouble, I think that something is happening due to the fact that it runs in Tomcat...

This is the page that calls the route:

<!DOCTYPE html>
<html ng-app="appCliente">
<head>
<meta charset="UTF-8"/>
<title>Insert title here</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-route.js"></script>
<script src="./js/app.js"></script>
<script src="./js/controller/cliente-controller.js"></script>
<script src="./js/controller/estado-controller.js"></script>
<script src="./js/controller/cidade-controller.js"></script>
</head>
<body>
 <a href="#/clientes">Clientes</a> 
 
  <div ng-view="ng-view">
  
 </div>

</body>
</html>

And this is the app declaration JS file:

var appCliente = angular.module('appCliente', ['ngRoute']); 

appCliente.config(function($routeProvider){
 $routeProvider
 .when('/clientes', {
  controller:'clienteController',
  template: '<h2>Something</h2>'
 })
 .otherwise({
  redirectTo:'/'
 });

});

Any idea of what seems to be the problem?

(I noticed that when I try to load the initial page - http://localhost:8080/ - Spring Boot is putting some characters after the url automatically - http://localhost:8080/#!/ - but it loads normally)

Denis Klein
  • 101
  • 1
  • 11
  • Its because this time you are using 1.6. Look at one of my earlier answers: https://stackoverflow.com/questions/41655534/angularjs-ngroute-not-working/41655831#41655831 give it at point up. – Anders Vestergaard Jul 05 '17 at 03:45
  • Yeah, that was it! Thank you very much, Anders (and your point up was given!) – Denis Klein Jul 07 '17 at 00:19

0 Answers0