我需要获取Http请求状态码(200,301,404) 并手动执行下一步。
如何在ui-router 状态更改中获取状态代码?
==更新==
当使用ui-router获取ui-view时,我们将获得200个text / html进行渲染。
但我想检查回复是否为301重定向网址
我应该怎么做呢
==更新==
我发现有一段
A response status code between 200 and 299 is considered a success status and will result
in the success callback being called. Note that if the response is a redirect,
XMLHttpRequest will transparently follow it, meaning that the error callback will not be
called for such responses.
来自https://docs.angularjs.org/api/ng/service/ $ http
答案是答案吗? (自动重定向网址)
答案 0 :(得分:2)
没有。 HTTP状态代码用于来自服务器的HTTP消息。它们与客户端路由框架无关。