MCPcopy Create free account
hub / github.com/TanStack/db / addTodo

Method addTodo

examples/angular/todos/src/app/app.ts:155–168  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

153 newTodoText = ''
154
155 addTodo() {
156 if (!this.newTodoText.trim()) return
157
158 const newTodo = {
159 id: Date.now(),
160 text: this.newTodoText.trim(),
161 projectID: this.selectedProjectId(),
162 completed: false,
163 created_at: new Date(),
164 }
165
166 todosCollection.insert(newTodo)
167 this.newTodoText = ''
168 }
169
170 toggleTodo(id: number) {
171 todosCollection.update(id, (draft: any) => {

Callers 3

handleAddTodoFunction · 0.80
TodoListFunction · 0.80
handleAddTodoFunction · 0.80

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected