0

I am trying to include a json file with data, in a mean stack app running locally.

I have tried these methods, and I am still getting a 404 error

$http.get('MOCK_DATA.json').success(function (res){
    $scope.Alldata = res.data;
    $scope.$apply;

});
var getPromise = $http.get('MOCK_DATA.json').then(function(response){ 
  //whatever is returned here will be accessible in the .then that is chained
  return response.data;
});    

console.log(getPromise);

$http({
  method: 'get',
  url: 'MOCK_DATA.json'
}).then(function (response){
  $scope.Alldata = response;
},function (error){

});

1 Answers1

0

Just need to import json file from correct file and you will get access of it like var data = require('./data.json');