Skip to content

Instantly share code, notes, and snippets.

@gavilanch
Created June 17, 2019 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gavilanch/4cd5aaccef70243a4532ef73204dd01f to your computer and use it in GitHub Desktop.
Save gavilanch/4cd5aaccef70243a4532ef73204dd01f to your computer and use it in GitHub Desktop.
todos: TodoViewModel[] = [];
loadTodos() {
this.todoService.getTodos().subscribe(response => {
this.todos = [];
response.docs.forEach(value => {
const data = value.data();
const id = value.id;
const todo: TodoViewModel = {
id: id,
title: data.title,
description: data.description,
done: data.done,
lastModifiedDate: data.lastModifiedDate.toDate()
};
this.todos.push(todo);
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment