// ticker.component.ts import { Component, OnInit, OnDestroy } from '@angular/core'; import { interval, Subscription } from 'rxjs'; @Component({ selector: 'app-ticker', standalone: true, template: `
Ticker running — check the console.
`, }) export class TickerComponent implements OnInit, OnDestroy { private sub?: Subscription; private count = 0; ngOnInit() { this.sub = interval(1000).subscribe(() => { this.count++; console.log('tick', this.count); }); } ngOnDestroy() { console.log('TickerComponent destroyed — unsubscribing'); this.sub?.unsubscribe(); } } // app.component.ts import { Component } from '@angular/core'; import { TickerComponent } from './ticker.component'; @Component({ selector: 'app-root', standalone: true, imports: [TickerComponent], template: ` @if (show) {