I am trying to code in Angular to such that it reloads entire HTML page automatically after 10 seconds.
Please help how to do it, i am new to Angular 2.
Thanks in advance.
I am trying to code in Angular to such that it reloads entire HTML page automatically after 10 seconds.
Please help how to do it, i am new to Angular 2.
Thanks in advance.
you have two choices:
1- Using ng2-simple-timer-example:
Angular 2 has a simple component that handle timer: ng2-simple-timer-example
This plunker shows the result:
2- setTimout:
As @Araivnd mentions you can using ngOnInit(angular calls ngOnInit after creating the component) and setTimout as following:
ngOnInit(){
setTimeout(function(){
//code here
},10000);
}