Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 1x 1x 1x 34x 34x 25x 34x 33x | import { Component, OnDestroy, OnInit } from '@angular/core'; import { Subscription } from 'rxjs'; import { AlertService } from '../../services'; /** * Alert Component */ @Component({ selector: 'app-alert', templateUrl: 'alert.component.html' }) export class AlertComponent implements OnDestroy, OnInit { /** message object */ message: any; /** subscription */ subscription: Subscription | undefined; /** * constructor of AlertComponent * @param alertService: AlertService */ constructor(public alertService: AlertService) { } /** * ngOnInit */ ngOnInit(): void { this.subscription = this.alertService.getMessage() .subscribe(message => { this.message = message; }); } /** * ngOnDestroy */ ngOnDestroy(): void { if (this.subscription !== undefined) { this.subscription.unsubscribe(); } } } |