-
-
Save parzibyte/a5e5704f05928778d43d26ad5c58f5e6 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
import { Injectable } from '@angular/core'; | |
import { TareaPendiente } from './tarea-pendiente'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class TareasService { | |
CLAVE_LOCAL_STORAGE = "tareas_angular" | |
constructor() { } | |
obtenerTareas(): TareaPendiente[] { | |
return JSON.parse(localStorage.getItem(this.CLAVE_LOCAL_STORAGE) || "[]") | |
} | |
guardarTareas(tareas: TareaPendiente[]) { | |
localStorage.setItem(this.CLAVE_LOCAL_STORAGE, JSON.stringify(tareas)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment