How to implement timeout in Ionic application?


#1

I have an application that makes several ajax calls to pull information from the server and render them on the client. But there was no timeout implemented on the app. I want to set a time out property for the ajax calls and display the users an error message… Can anyone help me implementing that??


#2

Just before calling Ajax call start by running:
"myTo = setTimeout(function(){alert(‘Error message’)},2000)"
then if the Ajax call went fine: “clearTimeout(myTo)”


#3

Can you give an example with an ajax call. This will be very helpful. Thanks in advance.


#4

You can take a look at this post: