Questions tagged settimeout

Explore the latest questions and answers asked by our top developers.

Angular stop component from running after it has been clicked off of

Currently, I have a sidebar that allows me to click on individual components. These components refresh API calls to get data. However, when I click off the components to another component, the old component keeps on refreshing API data, even though it is not needed as I have clicked off from it. Here is a […]

By GolfBravo
Published
Categorized as angular, refresh, settimeout, typescript Tagged , , ,

using setTimeout to reload child component instead of ngOnChanges inside it

Maybe for someone, this question will sound a little dumb. For me, is an unexpected behavior because I reuse a child component and I found that the data inside it are not updated when I change the source from parent. Because I don’t want to implement ngOnChanges there (I try to avoid using it how […]

By AlleXyS
Published
Categorized as angular, javascript, settimeout, typescript Tagged , , ,

Custom Angular notification message display problem using setTimeout()

I am facing issue with displaying notification message on the screen. When I click on the button to display the notification message, the popup is displayed and removed after several seconds defined in the interval. But when I click the button couple more times, the popup won´t stay visible for let´s say 2 seconds but […]

By Victoria
Published
Categorized as angular, notifications, popup, settimeout Tagged , , ,

How to call the setTimeout?

I am being given the below mentioned code and asked to print the console after 3 seconds – B and C after A. I tried setTimeout(main(),3000); But I get no output. function sleep(){ } function main(){ console.log(‘A’); // call after 3 sec console.log(‘B’); // call after 3 sec console.log(‘C’); } } Source: Angular Questions

By Sucheta Shrivastava
Published
Categorized as angular, javascript, jquery, settimeout Tagged , , ,

ng-idle logout not happening when I move to another tab

I implemented ng-idle timeout in my application. setIdle time we gave is 8min and the setTimeout is 1min. Now it is working fine when i’m inside the tab. But when I move to another tab/ another application the logout is not firing until I come back to the tab. The logout is supposed to happen […]

angular ngAfterViewInit element focus not workin

When loading a component, I want you to focus on the first element after initialization. I found a tutorial for this, but it doesn’t want to work for me. https://davidmcintosh.medium.com/auto-focusing-an-angular-input-the-easy-way-part-1-dcb1799e025f But if I put it in a timer that is 0 then it works great. But I don’t want to use timer. ngAfterViewInit(): void { […]

By B lint Bakos
Published
Categorized as angular, settimeout, typescript Tagged , ,

How to use JSON variable in setInterval delay in Angular 11 [duplicate]

I am working on Angular 11 project. I want to loop the code after ‘X’ duration mentioned in JSON.data. Here is my following code snippet. data.json pageOrder: { pageDetails:[ { "duration": 5 }, { "duration": 7 }] } app.component.ts id: any = 0; reloadFunction(); …. …. …. reloadFunction(): void { // most of your code […]

How can I get the current value of getBoundingClientRect of a HTML element after a CSS transition

I’m applying a class to a HTML element which applies a CSS transition that increases the width of that element (of 50px), and I’d like to check that the final width is correct (by using getBoundingClientRect). The issue here is that the width from getBoundingClientRect is still the initial one, whereas from Karma I can […]

How to replace setTimeout in Angular

I wonder how can i replace setTimeout() in Angular. I have got something like this public resetSelect: boolean = false; private clearSelection(): void { this.resetSelect = true; this.myForm.get(‘time’).setValue(null); this.myForm.get(‘colors’).setValue(null); this.myForm.removeControl(‘drinks’); this.myForm.removeControl(‘food’); setTimeout(() => { this.resetSelect = false; }, 200); } resetSelect is set to true, to call a function by @Input() in other component. Source: […]

By JSonChild
Published
Categorized as angular, settimeout Tagged ,

How to delay execution of function in Angular/Typescript

could only find JS stuff on this. I just have basic functions that reload page elements and I want to delay them by like 1-2 seconds to wait for http calls to come through. I tried this (imported from rxjs to) but it doesn’t work at all setTimeout(function () { this.clearGroups(); this.prepareRow(); this.prepareGroups(); }, 2000); […]

1 2 3

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq