1 import { Component, OnInit, ViewEncapsulation } from '@angular/core';
2 import { Observable } from 'rxjs/Observable';
4 import { ProjectService, IProject } from '../services/project.service';
8 templateUrl: './devel.component.html',
9 styleUrls: ['./devel.component.css'],
10 encapsulation: ViewEncapsulation.None
13 export class DevelComponent implements OnInit {
16 Prjs$: Observable<IProject[]>;
18 constructor(private projectSvr: ProjectService) {
22 this.Prjs$ = this.projectSvr.Projects$;
23 this.Prjs$.subscribe((prjs) => {
24 // Select project if no one is selected or no project exists
25 if (this.curPrj && 'id' in this.curPrj) {
26 this.curPrj = prjs.find(p => p.id === this.curPrj.id) || prjs[0];
27 } else if (this.curPrj == null) {
28 this.curPrj = prjs[0];