You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firefox has a problem with correctly receiving the JSON formatted data, the issue is caused by the request headers that it sends along. The default: Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
Google Chrome by contrast sends this request header, which accepts anything:
Accept: */*
So, if you’re using Firefox, when you get to this point in the book, where the list of books is expected, nothing appears. Nothing appears because ng server has sent back the main index.html instead of the desired JSON in response, viewing Firefox’s developer tools console shows this error:
EXCEPTION: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
(The first and unexpected character is the first character <.)
The Fix
One way to fix this is to change the Header sent with the http.get.
Hey @neeklamy, I just want to acknowledge that I'm seeing these issues you've submitted as say thanks for the help. I'll be going through and addressing all these soon.
The Problem
Firefox has a problem with correctly receiving the JSON formatted data, the issue is caused by the request headers that it sends along. The default:
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
Google Chrome by contrast sends this request header, which accepts anything:
Accept: */*
So, if you’re using Firefox, when you get to this point in the book, where the list of books is expected, nothing appears. Nothing appears because
ng server
has sent back the mainindex.html
instead of the desired JSON in response, viewing Firefox’s developer tools console shows this error:(The first and unexpected character is the first character
<
.)The Fix
One way to fix this is to change the Header sent with the
http.get
.Before:
After:
Maybe there’s a better way? Maybe this will be fixed in Angular?
Source: angular/angular-cli#889
The text was updated successfully, but these errors were encountered: