Skip to content

Instantly share code, notes, and snippets.

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 {
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: `
export class AstronautComponent extends BaseComponent {
@Input() astronaut: string;
mission = '<no mission announced>';
confirmed = false;
announced = false;
constructor(private missionService: MissionService) {
super();
missionService.missionAnnounced$