On Ionic 1.x, i have create a helper to handle the errors alerts from request in http. But now im the version 2.x, i’m a little confused on how can i handle this, calling multiple functions for feed back. Like a button with “Try Again” triggering the specific function used.
I replace Http for my service and redefined all http method, and implements my own methods to catch http.
Methods like onCatch to handler errors.
Methods like requestInterceptor and responseInterceptor to show/hide spinner
i’m using promisses on the services for now.
But on Ionic 1 i usually pass a function to the handle error of the request, like a “Try Again” button on the alert, and have created a helper of alerts to all request status. But i tried this on Ionic 2, and just don’t work.
I know that this is because the away of Typescript, and the Object Oriented way of it, like Java.
Is like the function is detroyed on the execution of the code, you know? I can’t explain because i’m using Ionic 2 directly, and not studied Typescript before using it.