Correctly configure routes in angularjs

1

I have the routes configured in my file crud.js in the following way:

app.config(function($routeProvider){
$routeProvider.when('/',{
    templateUrl: 'vistas/estudiantes.html',
    controller: 'ListarEstudiantesController'
}).when('/estudiantes',{
    templateUrl: 'vistas/estudiantes.html',
    controller: 'ListarEstudiantesController'
}).when('/estudiantes/nuevo',{
    templateUrl: 'vistas/form.estudiante.html',
    controller: 'CrearEstudianteController',
    controllerAs: 'ctrl'
}).when('/estudiantes/:id/edit',{
    templateUrl: 'vistas/form.estudiante.html',
    controller: 'EditarEstudianteController',
    controllerAs: 'ctrl'
}).otherwise({redirecTo: 'vistas/estudiantes.html'});

});

And in my file students.html I have the following button:

<a href="#/estudiantes/nuevo" class="btn btn-primary">Crear estudiante</a>

But clicking the button does not go to the route, but if I write it in the address bar of the browser it works.

    
asked by Grover Vásquez 19.01.2017 в 16:42
source

1 answer

0

Hello, have you tried putting the link in this way?

<a href="#!/estudiantes/nuevo" class="btn btn-primary">Crear estudiante</a>

    
answered by 23.02.2017 в 18:46