diff --git a/src/app/common/models/project.model.ts b/src/app/common/models/project.model.ts index fe8b577..8645717 100644 --- a/src/app/common/models/project.model.ts +++ b/src/app/common/models/project.model.ts @@ -5,7 +5,8 @@ export interface Project { description: string; id: string; link: string; - status: string; + status: Status; + order: number; title: string; updated: Date; } diff --git a/src/app/pages/projects/projects.component.ts b/src/app/pages/projects/projects.component.ts index 5a261c3..592aafb 100644 --- a/src/app/pages/projects/projects.component.ts +++ b/src/app/pages/projects/projects.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { Observable } from 'rxjs'; +import { Observable, map } from 'rxjs'; import { Project } from 'src/app/common/models/project.model'; import { ProjectsService } from 'src/app/common/services/projects.service'; @@ -18,6 +18,9 @@ export class ProjectsComponent implements OnInit { public ngOnInit(): void { this.projectsService.getProjects$() + .pipe( + map(projects => projects.sort((a, b) => a.order - b.order)) + ) .subscribe(projects => { this.projects = projects; });