-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlista.js
More file actions
108 lines (99 loc) · 2.8 KB
/
lista.js
File metadata and controls
108 lines (99 loc) · 2.8 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
'use strict';
var app = angular.module('myApp', ['ngRoute']);
app.config([
'$routeProvider',
'$locationProvider',
function($routeProvider, $locationProvider) {
$locationProvider.html5Mode({
enabled: true,
requireBase: false
});
$routeProvider.
when('/', {
templateUrl: 'inicio.html'
}).
when('/tareas', {
controller: 'ControladorTareas',
templateUrl: 'tareas.html'
}).
when('/empleados', {
controller: 'ControladorEmpleados',
templateUrl: 'empleados.html'
}).
otherwise({
redirectTo: '/'
});
}
]);
app.factory('Empleados', [
function() {
return [
{
nombre: 'Ana', paterno: 'Guzman', materno: 'Guzman', primerDia: new Date(), salario: 12000, telefono: '990876543', bono: 1.456789
},
{
nombre: 'Kenroy', paterno: 'Chuquimia', materno: 'Ramos', primerDia: new Date(), salario: 22000, telefono: '990436543', bono: 2.456789
},
{
nombre: 'María', paterno: 'Salas', materno: 'Guzman', primerDia: new Date(), salario: 11000, telefono: '890876543', bono: 3.456789
},
{
nombre: 'César', paterno: 'Mamani', materno: 'Huanacuni', primerDia: new Date(), salario: 14030, telefono: '390846543', bono: 2.453289
},
{
nombre: 'Luciana', paterno: 'Guzman', materno: 'Goyzueta', primerDia: new Date(), salario: 32000, telefono: '430876543', bono: 1.566789
},
{
nombre: 'Joseph', paterno: 'Ramos', materno: 'Arpasi', primerDia: new Date(), salario: 62000, telefono: '990546543', bono: 5.456789
}
]
}
]);
app.factory('Tareas', [
function() {
return [{
texto: 'Ser super heroico con AngularJS',
hecho: true
}, {
texto: 'Crear una aplicación con AngularJS',
hecho: true
}, {
texto: 'Ser una super programadora con AngularJS',
hecho: true
}];
}
]);
app.controller('ControladorTareas', [
'$scope',
'Tareas',
function($scope, Tareas) {
$scope.tareas = Tareas;
$scope.agregarTarea = function() {
$scope.tareas.push({texto: $scope.textoNuevaTarea, hecho: false});
$scope.textoNuevaTarea = '';
};
$scope.restantes = function() {
var cuenta = 0;
angular.forEach($scope.tareas, function(tarea) {
cuenta += tarea.hecho ? 0 : 1;
});
return cuenta;
};
$scope.eliminar = function() {
var tareasViejas = $scope.tareas;
$scope.tareas = [];
angular.forEach(tareasViejas, function(tarea) {
if (!tarea.hecho) $scope.tareas.push(tarea);
});
}
}]);
app.controller('ControladorEmpleados', [
'$scope',
'Empleados',
function($scope, Empleados) {
$scope.empleados = Empleados;
$scope.ordenarPor = function(orden) {
$scope.ordenSeleccionado = orden;
}
}
]);