Hello Michael,
I know it has been a while but my team is having trouble with the exact
same situation, and I'm wondering if you could share your solution.. We get
status=-1, with data=null and blank header data...we need to be able to
detect a 302 and redirect to whatever is in the "Location" header (I know
the header is present because it shows up in the browser, but not angular
app)
Refreshing the $window after a dead status didn't work for us...how can we
do this?
On Thursday, January 30, 2014 at 8:21:07 AM UTC-5, Michael Hunziker wrote:
>
> Hi Sander!
>
> Perfect!!! Thank you very much for your help!! I just upgraded to Angular
> 1.2.9 and i finally get a useful response status code.
>
> Best regards
> Michael
>
>
>
> Am Donnerstag, 30. Januar 2014 04:15:40 UTC+1 schrieb Sander Elias:
>>
>> Hi Michael,
>>
>> The response object in AngularJS looks like this:
>>> Object {data: "", status: 0, headers: function, config: Object}
>>>
>>> What I would expect is status code 302 and even the redirect location,
>>> so that I could handle the redirect to the login-page in Angular myself...
>>>
>> Well, I was assuming you got redirected by the browser. This is way
>> easier to manage! You gave already the solution too!
>>
>> On Wednesday, January 29, 2014 3:28:50 PM UTC+1, Michael Hunziker wrote:
>>>
>>> What I could do is implement an httpInterceptor which will handle
>>> response errors with status code 0. As soon as I get such a response I
>>> could trigger a $window.location.reload. This would again trigger the proxy
>>> and he would redirect us to the login page.
>>>
>> Be warned that in the new versions 1.2.9+ you will get an 404 instead of
>> a 0, and yo should also check for the string 'not allowed access' inside
>> your status. Just to make sure you don't direct to the login page on
>> anything then the login failure.
>>
>> Regards
>> Sander
>>
>>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.