Iam trying to make a schedule update for my page
like "subscribe" and "unsubscribe" repeatedly with
to make page update after 10 muntes or so and in the same time not makeing a headinc on the DataBase
import { Component, OnDestroy, OnInit } from '@angular/core';
import { Subscription } from 'rxjs';
import { MaintenanceServicesService } from './MaintinanceService/maintenance-services.service';
@Component({
selector: 'app-maintenance',
templateUrl: './maintenance.component.html',
styleUrls: ['./maintenance.component.scss']
})
export class MaintenanceComponent implements OnInit, OnDestroy {
pageCards: any[] = []
subscripe?: Subscription
constructor(private _MaintenanceServicesService: MaintenanceServicesService) {
}
ngOnInit(): void {
this.subscripe = this._MaintenanceServicesService.pageCards.subscribe({
next: () => {
this.GetPageCards()
}
});
}
ngOnDestroy(): void {
if (this.subscripe) {
this.subscripe.unsubscribe()
}
}
GetPageCards() {
this._MaintenanceServicesService.GetServicesPageCards()
this.pageCards = this._MaintenanceServicesService.pageCards.getValue()
}
}