AngularJS - routeProvider generates invalid url

0

When I try to call my "option1" file from my templates folder in the url, only

appears
  

link

and it does not allow me to accelerate to my route more without encambio if I modify the URL to

  

link

he calls me correctly I define my navigation bar as follows:

<ul>
<li><a href="#/opcion1">Opción 1</a></li>
<li><a href="#/opcion2">Opción 2</a></li>
<li><a href="#/opcion3">Opción 3</a></li>
<li><a href="#/opcion4">Opción 4</a></li>
<li><a href="#/">Inicio</a></li>
</ul>

and I make the call from AngularJS with:

var mainAplication = angular.module('herbApp', ['ngRoute']);
mainAplication.config(['$routeProvider', function ($routeProvider) {
$routeProvider.when('/', {
    templateUrl: 'resources/temps/inicio.php',
    controller: 'inicio'
})
.when('/opcion1', {
    templateUrl: 'resources/temps/opcion1.php',
    controller: 'inicio'
})

}])

I hope you can help me, I would appreciate it too much.

    
asked by Rodrigo Arenas 18.10.2017 в 06:49
source

1 answer

0

You have to add the #! symbol to the url. According to the commit aa077e8 , the ! symbol is now added to the url.

So change:

<ul>
 <li><a href="#/opcion1">Opción 1</a></li>
 <li><a href="#/opcion2">Opción 2</a></li>
 //...
</ul>

By:

<ul>
 <li><a href="#!/opcion1">Opción 1</a></li>
 <li><a href="#!/opcion2">Opción 2</a></li>
 //...
</ul>
    
answered by 18.10.2017 / 14:50
source