diff --git a/src/app/component/home/home.component.html b/src/app/component/home/home.component.html
index 5f2c53f..38839d5 100644
--- a/src/app/component/home/home.component.html
+++ b/src/app/component/home/home.component.html
@@ -1 +1,15 @@
-
home works!
+home works!
+
+Task List
+
+
+
+
+ Loading tasks...
+
+
+Temps écoulé : {{ count / 2 }} secondes
\ No newline at end of file
diff --git a/src/app/component/home/home.component.ts b/src/app/component/home/home.component.ts
index 35c8e26..55b000d 100644
--- a/src/app/component/home/home.component.ts
+++ b/src/app/component/home/home.component.ts
@@ -1,11 +1,28 @@
+
import { Component } from '@angular/core';
+import { CommonModule, AsyncPipe } from '@angular/common';
+import { TaskService } from '../../service/task.service';
@Component({
selector: 'app-home',
- imports: [],
+ imports: [CommonModule, AsyncPipe],
templateUrl: './home.component.html',
styleUrl: './home.component.css'
})
export class HomeComponent {
+ protected count = 0;
+
+ tasks$!: ReturnType;
+
+ constructor(private taskService: TaskService) {
+ this.tasks$ = this.taskService.getTasks();
+ }
+
+ ngOnInit() {
+ setInterval(() => {
+ this.count++;
+ console.log(this.count);
+ }, 500);
+ }
}
diff --git a/src/app/service/task.service.spec.ts b/src/app/service/task.service.spec.ts
new file mode 100644
index 0000000..0bbd214
--- /dev/null
+++ b/src/app/service/task.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { TaskService } from './task.service';
+
+describe('TaskService', () => {
+ let service: TaskService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(TaskService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/service/task.service.ts b/src/app/service/task.service.ts
new file mode 100644
index 0000000..d8e06b8
--- /dev/null
+++ b/src/app/service/task.service.ts
@@ -0,0 +1,14 @@
+import { Injectable } from '@angular/core';
+import { of } from 'rxjs';
+import { delay } from 'rxjs/operators';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class TaskService {
+ private tasks = [{id: 1 , title: 'Sample Task'}, {id: 2, title: 'Another Task'}, {id: 3, title: 'More Tasks'}];
+
+ getTasks() {
+ return of(this.tasks).pipe(delay(1000));
+ }
+}