-
-
Save gavilanch/5701b8a8e5dfb7f95acb08d00361b3ec 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
saveTodo() { | |
// Validate the form | |
if (this.todoForm.invalid) { | |
return; | |
} | |
let todo: Todo = this.todoForm.value; | |
todo.lastModifiedDate = new Date(); | |
todo.createdDate = new Date(); | |
this.todoService.saveTodo(todo) | |
.then(response => this.handleSuccessfulSaveTodo(response, todo)) | |
.catch(err => console.error(err)); | |
} | |
handleSuccessfulSaveTodo(response: DocumentReference, todo: Todo) { | |
// Send info to the todo-list component | |
this.activeModal.dismiss({ todo: todo, id: response.id }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment