This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, Input, OnInit } from '@angular/core'; | |
import { MissionService } from './mission.service'; | |
import { DestroyableComponent, componentDestroyed } from 'ng2-rx-destroyable-component'; | |
@DestroyableComponent | |
@Component({ | |
selector: 'my-astronaut', | |
template: ` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class AstronautComponent extends BaseComponent { | |
@Input() astronaut: string; | |
mission = '<no mission announced>'; | |
confirmed = false; | |
announced = false; | |
constructor(private missionService: MissionService) { | |
super(); | |
missionService.missionAnnounced$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { OnDestroy } from '@angular/core'; | |
import { Subject } from 'rxjs/Subject'; | |
export abstract class BaseComponent implements OnDestroy { | |
protected destroyed$: Subject<boolean> = new Subject(); | |
protected constructor() {} | |
ngOnDestroy(): void { |