I am building an app for a school. Students can scan id cards and enter. On teacher's side application, I am showing number of students present in particular class. Now, I am using refresher to load page to show the number of students.
<ion-content>
<ion-refresher (ionRefresh)="doRefresh($event)">
<ion-refresher-content></ion-refresher-content>
</ion-refresher>
</ion-content>
export class NumberOfStudents{
doRefresh(refresher) {
console.log('Begin async operation', refresher);
setTimeout(() => {
console.log('Async operation has ended');
refresher.complete();
}, 2000);
}
}
Help me in achieving executing above code automatically in background without pulling to refresh. Give me an idea on how to call the api every 2 minutes or like that without affecting the view.