Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

setinterval in angular 6

ngOnInit() {
  this.battleInit();
  this.id = setInterval(() => {
    this.battleInit(); 
  }, 5000);
}

ngOnDestroy() {
  if (this.id) {
    clearInterval(this.id);
  }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #setinterval #angular
ADD COMMENT
Topic
Name
8+3 =