0

I'm a Noob to AngularJS so not sure if this is possible but i have a local JSON file that i would like to read and display the contents on a web page....

I've seen some example of reading json but all seem to involve running a server... Is it possible to retrieve the data from just a file read?

something like below (which doesnt work)

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

    $http.get('C:\test.json').success(function (data){
        $scope.tables = data;
    });

}]);
blu10
  • 534
  • 2
  • 6
  • 28
  • 1
    That code will only work if you run a server . Otherwine NO. – Zee May 13 '15 at 10:36
  • If you're reluctant to install lots of server stuff then I'd suggest installing virtualbox and vagrant, and using a vm to get a dev environment / "server". After installing virtualbox and vagrant it's just two commands to fire up a new project/machine. https://box.scotch.io/ – JimL May 13 '15 at 10:58
  • thanks guys, again another Noob question... but would a quick way to get this to work be installing NodeJS and creating an endpoint for my angular app to call and retrieve the file?. I remember seeing a Node module that would help me read the file contents and i could use a full file path to get it.. Id like to make it as simple as possible as others will be using the app locally so would need a similar set up – blu10 May 13 '15 at 11:29

0 Answers0