1 import { Component } from '@angular/core';
3 import { Observable } from 'rxjs';
5 import { ProjectService, IProject } from "../services/project.service";
10 templateUrl: './devel.component.html',
11 styleUrls: ['./devel.component.css'],
14 export class DevelComponent {
17 Prjs$: Observable<IProject[]>;
19 constructor(private projectSvr: ProjectService) {
23 this.Prjs$ = this.projectSvr.Projects$;
24 this.Prjs$.subscribe((prjs) => {
25 // Select project if no one is selected or no project exists
26 if (this.curPrj && "id" in this.curPrj) {
27 this.curPrj = prjs.find(p => p.id === this.curPrj.id) || prjs[0];
28 } else if (this.curPrj == null) {
29 this.curPrj = prjs[0];