0

I created a GitHub Pages project with AngularJS, the Angular content does not load from the json file, and I am getting a 404 error in the console:

Failed to load resource: the server responded with a status of 404 () birds.json

It is supposed to be just a client-side app. What is going on here? Does it have something to do with html5mode?

Repo

Demo

Related Questions:

Can one host an AngularJS based static blog on github?

AngularJS html5mode support on GitHub Pages

1 Answer 1

1

It's because your birds.json lies in the angular-birds directory. Try to change

var promise = $http.get('/birds.json').then(function (response) {
                return response.data;
                });

to

var promise = $http.get('angular-birds/birds.json').then(function (response) {
                return response.data;
                }); 

You may check out this AngularJS repository which I used to build and deploy my own website on github pages. Here is the demo.

Sign up to request clarification or add additional context in comments.

2 Comments

You were right. I had to add the sub-directory angular-birds in a few other places, too: /angular-birds/slideshow-products.json, and in birds.html, I had to update the link to: /angular-birds/images/{{bird.img}} I just don't know how I am going to remember that later on!
The link /angular-birds/birds.json has to have a preceding slash.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.