+
+
+
-
@@ -23,12 +26,12 @@
-
+
-
+
diff --git a/src/app/Todo-List-App/containers/TodoList/todo-list.component.ts b/src/app/Todo-List-App/containers/TodoList/todo-list.component.ts
index 2d9b903..ab3665e 100644
--- a/src/app/Todo-List-App/containers/TodoList/todo-list.component.ts
+++ b/src/app/Todo-List-App/containers/TodoList/todo-list.component.ts
@@ -70,25 +70,16 @@ export class TodoList{
// this.taskId++;
}
- //delete function
- deleteTask(tasks: Tasks){
- this.tasks = this.tasks.filter(task => task.id !== tasks.id);
-
- this.todoService.deleteTask(tasks)
- .subscribe(data => this.tasks.filter(task => {
- return task.id !== data;
- }))
- }
-
toggleEdit(event: Tasks){
event.editing = !event.editing;
}
- editTask(event: Tasks): void{
+ editTask(event: Tasks){
this.beforeEditing = event.title;
event.editing = !event.editing;
this.todoService.editTodo(event)
.subscribe(data => this.tasks = this.tasks.map((task: Tasks )=>{
+
if (task.title === event.title){
task = Object.assign({}, task, event);
}
@@ -96,6 +87,10 @@ export class TodoList{
}));
}
+ console(){
+ console.log("try function");
+ }
+
doneEditing(task: Tasks):void{
if(task.title.trim().length === 0){
task.title = this.beforeEditing;
@@ -105,7 +100,7 @@ export class TodoList{
cancelEditing(task: Tasks){
task.title = this.beforeEditing;
- task.editing = false;
+ // task.editing = false;
}
remaining(): number{
@@ -115,9 +110,23 @@ export class TodoList{
atleastOneCompleted(): boolean{
return this.tasks.filter(task => task.completed).length > 0;
}
+ //delete function
+ deleteTask(tasks: Tasks){
+ this.tasks = this.tasks.filter(task => task.id !== tasks.id);
- clearCompleted(): void{
+ this.todoService.deleteTask(tasks)
+ .subscribe(data => this.tasks.filter(task => {
+ return task.id !== data;
+ }))
+ }
+
+ clearCompleted(tasks: Tasks){
this.tasks = this.tasks.filter(task => !task.completed);
+
+ this.todoService.deleteTask(tasks)
+ .subscribe(data => this.tasks.filter(task => {
+ return task == data;
+ }))
}
selectAll():void{
diff --git a/src/app/Todo-List-App/services/todo.service.ts b/src/app/Todo-List-App/services/todo.service.ts
index f5441bf..1178731 100644
--- a/src/app/Todo-List-App/services/todo.service.ts
+++ b/src/app/Todo-List-App/services/todo.service.ts
@@ -18,7 +18,6 @@ export class TodoService{
'Content-Type': 'application/json'
})
})
-
}
editTodo(task: Tasks):Observable
{
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 8d05102..184d201 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -7,11 +7,13 @@ import { AppComponent } from './app.component';
import { TodoList } from './Todo-List-App/containers/TodoList/Todo-list.component';
import { TodoService } from './Todo-List-App/services/todo.service';
import { HttpClientModule } from '@angular/common/http';
+import { TodoEmptyComponent } from './Todo-List-App/components/todo-empty/todo-empty.component';
@NgModule({
declarations: [
AppComponent,
- TodoList
+ TodoList,
+ TodoEmptyComponent
],
imports: [
BrowserModule,
diff --git a/src/assets/to-do.png b/src/assets/to-do.png
new file mode 100644
index 0000000..b55483c
Binary files /dev/null and b/src/assets/to-do.png differ