show component
This commit is contained in:
7
src/app/modules/shows/show/show.component.html
Normal file
7
src/app/modules/shows/show/show.component.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<div *ngIf="(show$|async) as show">
|
||||
<app-card
|
||||
heading="{{show.showType|showType}}, {{show.date.toDate()|date:'dd.MM.yyyy'}}">
|
||||
|
||||
|
||||
</app-card>
|
||||
</div>
|
||||
0
src/app/modules/shows/show/show.component.less
Normal file
0
src/app/modules/shows/show/show.component.less
Normal file
25
src/app/modules/shows/show/show.component.spec.ts
Normal file
25
src/app/modules/shows/show/show.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {ShowComponent} from './show.component';
|
||||
|
||||
describe('ShowComponent', () => {
|
||||
let component: ShowComponent;
|
||||
let fixture: ComponentFixture<ShowComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ShowComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ShowComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
29
src/app/modules/shows/show/show.component.ts
Normal file
29
src/app/modules/shows/show/show.component.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {map, switchMap} from 'rxjs/operators';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {ShowService} from '../services/show.service';
|
||||
import {Observable} from 'rxjs';
|
||||
import {Show} from '../services/show';
|
||||
|
||||
@Component({
|
||||
selector: 'app-show',
|
||||
templateUrl: './show.component.html',
|
||||
styleUrls: ['./show.component.less']
|
||||
})
|
||||
export class ShowComponent implements OnInit {
|
||||
public show$: Observable<Show>;
|
||||
|
||||
constructor(
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private showService: ShowService
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.show$ = this.activatedRoute.params.pipe(
|
||||
map(param => param.showId),
|
||||
switchMap(showId => this.showService.read$(showId))
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user