rails, retry logic Restangular

I am very naive here so please excuse me if my question sounds very simple or ridiculous.

In mobile app I want to implement retry logic so that when user’s are not in proper network and are unable to connect to app smoothly.

I have rails as a backend and I am using IONIC framework for frontend. Please guide me to how to go about it.