UI路由器GET HTTP状态code时,状态变化 [英] ui-router get Http Status Code when state change

查看:137
本文介绍了UI路由器GET HTTP状态code时,状态变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要得到HTTP请求的状态code(200301404)
和手动执行下一步。

I need to get the Http request status code (200,301,404) and manually do the next step.

我如何获得状态code 在UI路由器的状态变化

How do I get the status code in ui-router state change?

== ==更新

在使用UI的路由器获得UI的观点,我们将得到200 text / html的渲染。

When using ui-router to get ui-view, we will get 200 text/html to render.

但我想检查响应是301重定向URL

But I want to check if the respond is 301 redirect url

我应该怎么做这个

== ==更新

我发现有一个段落

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

时的答案吗? (自动重定向URL)

Is the the answer? (auto redirect url)

推荐答案

没有。 HTTP状态codeS是HTTP消息,它们来自服务器。他们什么都没有做客户端的路由框架。

No. HTTP status codes are for HTTP messages, which come from servers. They have nothing to do with client-side routing frameworks.

这篇关于UI路由器GET HTTP状态code时,状态变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆