五分钟刷新一次页面,非常实用
constructor(public router: Router, public http: InterceptorService,
private fb: FormBuilder,
private iconService: NzIconService,
private tipMsgService: TipMessageService,
private httpClient: HttpClient) {
this.validateForm = this.fb.group({
disciplineInfo: ['', [Validators.required]],
missingInfo: ['', [Validators.required]]
});
this.timer = setInterval(() => {
this.getExamRoomMonitor(this.examRoomId);
}, 1000 * 60 * 5);
}
// 销毁组件时清除定时器
ngOnDestroy() {
if (this.timer) {
clearInterval(this.timer);
}
}