HTML
<exchange></exchange>
<exchange></exchange>
TS
@Component({
selector: 'exchange',
templateUrl: 'exchange.component.html',
})
export class ExchangeComponent implements OnInit {
ngOnInit() {
interval(10000).subscribe(x => {
console.log(x)});
}
}
In this scenario, the component is called twice but I only want the interval to run once every 10 seconds instead of twice. How can I achieve this without triggering the interval multiple times?