forked from carlosazaustre/angular-routing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
36 lines (30 loc) · 930 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Creación del módulo
var angularRoutingApp = angular.module('angularRoutingApp', ['ngRoute']);
// Configuración de las rutas
angularRoutingApp.config(function($routeProvider) {
$routeProvider
.when('/', {
templateUrl : 'pages/home.html',
controller : 'mainController'
})
.when('/acerca', {
templateUrl : 'pages/acerca.html',
controller : 'aboutController'
})
.when('/contacto', {
templateUrl : 'pages/contacto.html',
controller : 'contactController'
})
.otherwise({
redirectTo: '/'
});
});
angularRoutingApp.controller('mainController', function($scope) {
$scope.message = 'Hola, Mundo!';
});
angularRoutingApp.controller('aboutController', function($scope) {
$scope.message = 'Esta es la página "Acerca de"';
});
angularRoutingApp.controller('contactController', function($scope) {
$scope.message = 'Esta es la página de "Contacto", aquí podemos poner un formulario';
});