-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjs
More file actions
52 lines (38 loc) · 1.2 KB
/
js
File metadata and controls
52 lines (38 loc) · 1.2 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
var app = angular.module('universidadApp',[]);
app.controller('mainCtrl', ['$scope', function($scope){
$scope.personas = [];
$scope.fnAgregar = function(){
if($scope.nuevoNombre != null){
$scope.personas.push({nombre: $scope.nuevoNombre,
apellido: $scope.nuevoApellido,
edad: $scope.nuevaEdad});
$scope.nuevoNombre = null;
$scope.nuevoApellido = null;
$scope.nuevaEdad = null;
}else{
swal("Hello world!");
}
}
$scope.fnEliminar = function(){
if($scope.personas != null){
swal({
title: "Are you sure?",
text: "Once deleted, you will not be able to recover this imaginary file!",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then((willDelete) => {
if (willDelete) {
$scope.personas = [];
$scope.$apply();
swal("Poof! Your imaginary file has been deleted!", {
icon: "success",
});
} else {
swal("Your imaginary file is safe!");
}
});
}
}
}]);