angular - Delay for router in Angular2 -


i have code, have 2 functions: say() play music (is implemented , works) , router leads next page (it works also)

go_next() {      this.say(); // audio      this.router.navigate( ['app'], { queryparams: { 'part': this.part+1 } } ); //go next page  } 

but play music (it takes 5 sec) , go next page...how implement this?..i guess, have implement kind of delay, can't find such parameter router.navigate.

settimeout(function, milliseconds) executes function, after waiting specified number of milliseconds.

go_next(){     settimeout(() => {         this.router.navigate(['app'], {queryparams: {'part': this.part + 1}})       }       , 5000); } 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -