Hi All,
I currently have a web app that I’m wrapping inside an ionic app for android development. What I want to be able to do is to use http interceptors to track when the wrapped web app is about to navigate to a page with a certain URL and then rather than navigate to a different page using the inAppBrowser instead open the window in a modal window.
Currently I have my interceptor set up like so.
app.config(["$httpProvider", “$provide”, function ($httpProvider, $provide) {
// Intercept http calls.
$provide.factory(‘MyHttpInterceptor’, function ($q) {
return {
// On request success
request: function (config) {
console.log(config); // Contains the data about the request before it is sent.
// Return the config or wrap it in a promise if blank.
return config || $q.when(config);
},
// On request failure
requestError: function (rejection) {
console.log(rejection); // Contains the data about the error on the request.
// Return the promise rejection.
return $q.reject(rejection);
},
// On response success
response: function (response) {
console.log(response); // Contains the data from the response.
// Return the response or promise.
return response || $q.when(response);
},
// On response failture
responseError: function (rejection) {
console.log(rejection); // Contains the data about the error.
// Return the promise rejection.
return $q.reject(rejection);
}
};
});
// Add the interceptor to the $httpProvider.
$httpProvider.interceptors.push('MyHttpInterceptor');
}]);
Currently when the app navigates to a different page nothing happens, I don’t get any logs to console or errors.
Thanks for any help you can give me.