JavaScript AngularJS says json file does not exist

I am new to angularJS and am trying to use it to get data from a json file. When I run the program the console reads out there is a 404 error and that the file does not exist.

Here is the angular i am using to try to retrieve the json file.

var appLaptops = angular.module('appLaptops', []);

appLaptops.service("laptopsService", function ($http, $q) {
    var deferred = $q.defer();
    $http.get('json/laptops.json')
        .then(function (data) {
            deferred.resolve(data);
        });

    this.getLaptops = function () {
        return deferred.promise;
    }
})

appLaptops.controller('ctrlLaptops', function ($scope, laptopsService) {
    var promise = laptopsService.getLaptops();
    promise.then(function (data) {
        $scope.laptop = data;
        //For testing
        console.log($scope.laptop);
    })
});

Below I will also attach links to a picture of the folder structure as well as the error readout.

Folder Structure: http://i.imgur.com/qgQIdYf.jpg

Error Readout: http://i.imgur.com/c54VLiI.jpg

Answer:1

I have a site here. Here's the code from my little form... <form method="get" action="https://www.google.com/search" target="_blank"> <table border="0" cellpadding="0"> <...

I have a site here. Here's the code from my little form... <form method="get" action="https://www.google.com/search" target="_blank"> <table border="0" cellpadding="0"> <...

  1. display text text
  2. display text from text file in html
  3. display text in text box html
  4. display text on mouseover for text in html
  5. tkinter display text in text box
  6. excel if text display text

I want clocks displaying different time zones on a webpage that i am designing.For this,i have embedded the javascript files from a webiste called qlock.The HTML code is as follows: <script type="...

I want clocks displaying different time zones on a webpage that i am designing.For this,i have embedded the javascript files from a webiste called qlock.The HTML code is as follows: <script type="...

  1. css align blocks horizontally
  2. align div blocks horizontally

Looking at these articles from Mozilla's JavaScript guide: Expressions Statements expressions are also considered assignment statements. In fact, in the second article one can read "any expression ...

Looking at these articles from Mozilla's JavaScript guide: Expressions Statements expressions are also considered assignment statements. In fact, in the second article one can read "any expression ...

We are developing a PhoneGap app. We have 3 cases like this: $("#dvData .quantity input").on('keyup', function() { var totalamount = 0; var discountAmount = 0; var LineAmount1 = 0; ...

We are developing a PhoneGap app. We have 3 cases like this: $("#dvData .quantity input").on('keyup', function() { var totalamount = 0; var discountAmount = 0; var LineAmount1 = 0; ...