Routes Angular-JS

2

Good evening! I'm new to single page application technology, and I'm finding it difficult to render my pages in Angular one, I have a button that clicks, shoots a route, it tries to load, but it does not appear on the page, I've already researched and tried to everything, I do not know where I'm going wrong

My module:

var modulo = angular.module("clienteCtrl", ["ngRoute"]);

My route:

    modulo.config(function($routeProvider){
  $routeProvider

  .when("/", {
        templateUrl: "view/formCadastrarCliente.html"
      })

  .when("/cadastrarCliente", {
    templateUrl: "view/formCadastrarCliente.html"
  });

});

My HTML:

    <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Bem - Vindo</title>

<link rel="stylesheet" href="css/application.css">

<!-- Importação do Angular JS -->
<script src="libs/angular.js"></script>

<!-- Importação do ng-route angular -->
<script src="libs/angular-route.js"></script>

<!-- Importação do controller -->
<script src="js/clienteCtrl.js"></script>

<!-- Importação das rotas -->
<script src="js/rotasCliente.js"></script>

</head>

<body ng-app = "clienteCtrl">

<a href="#/cadastrarCliente">Cadastrar cliente</a>

<div ng-include = "'menu.html'"></div> 

<div ng-view></div>

<div ng-include = "'footer.html'"></div>

</body>
</html>

By clicking on the link, the url looks like this: link

But the page does not load the content.

Thank you in advance!

    
asked by anonymous 28.03.2017 / 04:18

1 answer

2

Modify

modulo.config(function($routeProvider){
    $routeProvider

for

modulo.config(function($routeProvider, $locationProvider) {

        $locationProvider.hashPrefix('');

        $routeProvider

Your mistake is for a default behavior of angle 1.6.

    
28.03.2017 / 04:56