0

Currently, my app requires an internet connection to operate and pull external API data, I will be adding some syncing/storage and perhaps a network check in the next version.

For now, I have been trying to add a timeout to the data loading pages (), as currently if there is no web connection within the app. The "Please Wait..." just keeps going round with no option to go back. You have to close the app.

I tried adding in a timeout with rxjs imports in the data pages with no joy. Any ideas?

import 'rxjs/add/operator/timeout';

.timeout(8000)

Ideally it would be nice to have a "No internet connection" prompt on Timeout.

Here are the relevant app files http://plnkr.co/edit/NgHH41zsFcfXDyRApAXx?p=catalogue

1

1 Answer 1

0

Make use of the catch operator after the http.get request.

If the request fails, as it will if there is no internet connection, then return an an empty product list to trigger the subscription and dismiss the loading controller.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.