-
-
Save parzibyte/249c30836150e7f89eeb86a096553790 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Nota: aquí utilizo el índice porque solo trabajo con un array. Si tú usas | |
una base de datos probablemente quieras usar el ID del elemento en lugar del índice | |
*/ | |
eliminarTarea(indice: number) { | |
// Primero le preguntamos al usuario | |
const confirma = confirm("¿Realmente quiere eliminar la tarea?"); | |
if (!confirma) { | |
return; | |
} | |
// Eliminamos del arreglo y guardamos | |
this.tareas.splice(indice, 1); | |
this.tareasService.guardarTareas(this.tareas); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment