1

Is there any known and consolidated alternative for defining a new Angular scope reading data from outside? I am working on a demo that should make available a standalone html page which reads the data from the same html file position, and on client machines without any webserver. This because the HTML is generated on the fly from a pdf. Do you have any idea?

In my working code below I should change $http.get('data.json'.. to avoid the Google restriction (on Firefox my sample is working fine).

<script>
    var isisApp = angular.module('isisApp', []);
    isisApp.controller('ISISListCtrl', function($scope, $http) {
    $http.get('data.json').success(function(data) {
    $scope.IsisDocument = data;
    etc.....

and this is the error I get from Chrome: XMLHttpRequest cannot load file:///C:/temp/data.json. Cross origin requests are only supported for HTTP. angular.js:8081 Error: A network error occurred.

Thanks in advance Fabio

1 Answer 1

2

If you want to test your code, while developing, you have two options:

  • Use a local web server. You could use Node.js platform, using expressjs.
  • Start Chrome from the terminal with the –allow-file-access-from-files option
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.