validation

This commit is contained in:
imelilabourne 2020-09-15 14:14:07 +08:00
parent 88c04d6aa0
commit 23145d7ed9
6 changed files with 13 additions and 14 deletions

View File

@ -1,16 +1,10 @@
{ {
"tasks": [ "tasks": [
{ {
"title": "Study Angular 6", "title": "Angular 6",
"completed": false, "completed": false,
"editing": false, "editing": false,
"id": 1 "id": 1
},
{
"title": "Workout",
"completed": false,
"editing": false,
"id": 2
} }
] ]
} }

View File

@ -1,5 +1,5 @@
<div> <div>
<h3>Your list is Empty 👻</h3> <h3>All Task Accomplished 👻</h3>
<div class="img-div"> <div class="img-div">
<img src="../../../../assets/to-do.png" alt="to-do"> <img src="../../../../assets/to-do.png" alt="to-do">
</div> </div>

View File

@ -25,6 +25,7 @@ li > *{
.listBtn{ .listBtn{
max-width: 80px; max-width: 80px;
margin: 2px;
} }
.main{ .main{

View File

@ -4,12 +4,15 @@
<div class="header"> <div class="header">
<h1>TODO LIST</h1> <h1>TODO LIST</h1>
</div> </div>
<div *ngIf="remaining() !== 0">
<div class="info"><input type="checkbox" (change)="selectAll()">Select All</div> <div class="info"><input type="checkbox" (change)="selectAll()">Select All</div>
</div>
<div class="inputDiv"> <div class="inputDiv">
<input type="text" class="form-control addInput" placeholder="Things you want to do today?" [(ngModel)]="taskTitle" (keyup.enter) = "addTask()"> <input type="text" class="form-control addInput" placeholder="Things you want to do today?" [(ngModel)]="taskTitle" (keyup.enter) = "addTask()">
</div> </div>
<div class="content"> <div class="content">
<div *ngIf="remaining() ===0"> <!-- all task completed template-->
<div *ngIf="remaining() === 0">
<todo-empty></todo-empty> <todo-empty></todo-empty>
</div> </div>
<ul> <ul>
@ -23,7 +26,8 @@
</ng-template> </ng-template>
<!-- buttons switching --> <!-- buttons switching -->
<div *ngIf="!task.editing; else doneBtn" ><button class="btn btn-success listBtn"(click)="toggleEdit(task)" ><i class="fa fa-edit"> Edit</i></button></div>
<div *ngIf="!task.editing; else doneBtn" ><button [ngClass] = "{disabled: task.completed}" class="btn btn-success listBtn"(click)="toggleEdit(task)" ><i class="fa fa-edit"> Edit</i></button></div>
<ng-template #doneBtn> <ng-template #doneBtn>
<div> <div>
<button class="btn btn-success listBtn"(click)="editTask(task); toggleEdit(task)" ><i class="fa fa-edit">Done</i></button> <button class="btn btn-success listBtn"(click)="editTask(task); toggleEdit(task)" ><i class="fa fa-edit">Done</i></button>

View File

@ -100,7 +100,7 @@ export class TodoList{
cancelEditing(task: Tasks){ cancelEditing(task: Tasks){
task.title = this.beforeEditing; task.title = this.beforeEditing;
// task.editing = false; task.editing = false;
} }
remaining(): number{ remaining(): number{

BIN
src/assets/todo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB