Use angular to develop public accounts and use the $http service to access data. However, in the WeChat test, when the network is disconnected, the $http request is still executed and the error page jumps ( Because the interceptor is set up, when $http does not respond or the response fails, my custom interceptor will cause the page to jump. Go to a custom error page ) instead of prompting: wifi and mobile data disconnected , when the request is a normal http://www.baidu. com link, WeChat can prompt: WiFi and mobile data have been disconnected. How can I intercept the $http request and prompt correctly after the network is disconnected? Thank you
習慣沉默2017-05-15 17:12:15
You can prompt based on the status code returned by the http request, such as 404, 500, etc. to switch to different prompt pages