Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import {LiveAnnouncer} from '@angular/cdk/a11y';
import {Component, Input, OnDestroy, OnInit} from '@angular/core';
import {Subscription} from 'rxjs';
import {StoryEntry} from '../../Model/StoryEntry';
import {StoryService} from '../story.service';
selector: 'app-story-view',
templateUrl: './story-view.component.html',
styleUrls: ['./story-view.component.scss']
export class StoryViewComponent implements OnInit, OnDestroy {
public Entries: StoryEntry[] = [];
private entrySub: Subscription;
constructor(private storyService: StoryService,
private liveAnnouncer: LiveAnnouncer) {
// Hiding initialization of Entries collection
ngOnInit() {
this.entrySub = this.storyService.EntryAdded.subscribe(entry => this.onEntryAdded(entry));
ngOnDestroy() {
if (this.entrySub) {
this.entrySub = null;
private onEntryAdded(entry: StoryEntry) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.