In the latest version of Angular (v1.3.0), they added a fix for the content header for the / json application. Now all my answers get an error because they are invalid JSON. I know that I need to change the back-end for the response using a regular text header, but I can’t control it at the moment. Is there any way to pre-analyze the response before Angular tries to parse it?
I think this was the fix they made:
https://github.com/angular/angular.js/commit/7b6c1d08aceba6704a40302f373400aed9ed0e0b
The problem is that the answer that I get from the frontend has a security prefix that does not match the one that Angular checks.
I tried to add the http interceptor to the config, but this did not help, it still parses it after Angular.
$httpProvider.interceptors.push('parsePrefixedJson');
The error I get in my console (it comes from deserializing a JSON string in Angular):
SyntaxError: Unexpected token w
at Object.parse (native)
at fromJson ...
source
share