mardi 27 juin 2017

Unable to open json file in angularJS

I have a local json file in the same directory a the js file and index.html file. I am using firefox to view my website since chrome did not allow cross origin http requests. Here is my angular code:

(function(){
var app = angular.module('contactPage',[]);

app.controller('contactController',['$scope','$http',function($scope,$http){


    $http.get('contacts.json').then(function(data){
        $scope.contactList = data;
    })
}]);

})();

But this is giving me two errors in firefox: XML parsing error, syntax location error for the json file and a 'possibly unhandled rejection'

Screenshot of errors




Aucun commentaire:

Enregistrer un commentaire