How to use the `setTimeout` with Angular hooks?

I am trying to use a setTimeout under the hook. But I am getting that, the page keep hanging. what is the correct way to use the setTimeout under the angular hooks?

here is my code :

 ngAfterViewChecked() {
    const myTimeout = window.setTimeout(() => {
      console.log("3");
      clearTimeout(myTimeout); //on clearing no impact
    }, 5000);
  }

any one help me?

Live demo