IAmAkittycatAMA IAmAkittycatAMA - 3 months ago 14x
AngularJS Question

Factory Service unable to load json file

I have a

, in the same folder as the file below. When I run this however it's returning not found.

I have also tried putting the
request in a factory, but same result - not found. I also tried changing the
extension to
as was suggested elsewhere, but this also didn't work.

The rest of the code came with the angular seeds project.

Is there something i'm missing in the other files or some other trick to the get request?

'use strict';

var myApp = angular.module('myApp.view1', ['ngRoute']);

myApp.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/view1', {
templateUrl: 'view1/view1.html',
controller: 'View1Ctrl'

myApp.controller('View1Ctrl', [


function($scope, $http) {
$scope.quiz = res.data


The .json file must not be in the same folder as the js file. Relative paths are resolved relative to the including index.html file. If you have this structure:

| \-data.json

You have to $http.get("folder/data.json") in app.js to make it work.