Implements task saving and retrieving.
This commit is contained in:
7
src/app/main-page/main-page.component.html
Normal file
7
src/app/main-page/main-page.component.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<div>
|
||||
<h1>Todo List</h1>
|
||||
<div *ngFor="let task of tasks" [title]="task.creationDate">
|
||||
<h1>{{ task.title }}</h1>
|
||||
<p>{{ task.description }}</p>
|
||||
</div>
|
||||
</div>
|
||||
0
src/app/main-page/main-page.component.scss
Normal file
0
src/app/main-page/main-page.component.scss
Normal file
25
src/app/main-page/main-page.component.spec.ts
Normal file
25
src/app/main-page/main-page.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MainPageComponent } from './main-page.component';
|
||||
|
||||
describe('MainPageComponent', () => {
|
||||
let component: MainPageComponent;
|
||||
let fixture: ComponentFixture<MainPageComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ MainPageComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(MainPageComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
21
src/app/main-page/main-page.component.ts
Normal file
21
src/app/main-page/main-page.component.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Task } from '../core/entity/task';
|
||||
import { TaskService } from '../core/service/task.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-main-page',
|
||||
templateUrl: './main-page.component.html',
|
||||
styleUrls: ['./main-page.component.scss']
|
||||
})
|
||||
export class MainPageComponent implements OnInit {
|
||||
tasks: Task[] = [];
|
||||
|
||||
constructor(
|
||||
private _taskService: TaskService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this._taskService.tasks.subscribe(tasks => this.tasks = tasks);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user