42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import { WindowRefService } from './../../services/window-ref.service';
|
|
import { Component, HostListener, OnInit } from '@angular/core';
|
|
import { HttpClient } from '@angular/common/http';
|
|
import { VideoServices, VideoService } from '../home/video-services';
|
|
import { DateTime } from "luxon";
|
|
|
|
|
|
|
|
@Component({
|
|
selector: 'video-services-component',
|
|
templateUrl: './video-services.component.html',
|
|
styleUrls: ['./video-services.component.css'],
|
|
})
|
|
export class VideoServicesComponent implements OnInit {
|
|
|
|
public loading: boolean = true;
|
|
public services: VideoService[];
|
|
|
|
constructor(private http: HttpClient){ }
|
|
|
|
ngOnInit(){
|
|
this.http.get<VideoServices>('assets/json/videoServices.json')
|
|
.subscribe(res => {
|
|
this.services = res.videos.filter(v => v.isReady === true);
|
|
this.loading = false;
|
|
});
|
|
}
|
|
|
|
showVideo(index: number) {
|
|
this.services.forEach(s => {
|
|
(<any>s).show = false;
|
|
});
|
|
(<any>this.services[index]).show = true;
|
|
}
|
|
|
|
getTitle(index: number): string {
|
|
const title = this.services[index].title;
|
|
const dte = DateTime.fromISO(this.services[index].date, {zone: 'America/Denver'})
|
|
return title + ' | ' + dte.toLocaleString(DateTime.DATETIME_MED);
|
|
}
|
|
}
|