AngularJS Error: Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https AngularJS Error: Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https angularjs angularjs

AngularJS Error: Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https


This error is happening because you are just opening html documents directly from the browser. To fix this you will need to serve your code from a webserver and access it on localhost. If you have Apache setup, use it to serve your files. Some IDE's have built in web servers, like JetBrains IDE's, Eclipse...

If you have Node.Js setup then you can use http-server. Just run npm install http-server -g and you will be able to use it in terminal like http-server C:\location\to\app.


VERY SIMPLE FIX

  1. Go to your app directory
  2. Start SimpleHTTPServer


In the terminal

$ cd yourAngularApp~/yourAngularApp $ python -m SimpleHTTPServer

Now, go to localhost:8000 in your browser and the page will show


The operation is not allowed in chrome. You can either use a HTTP server(Tomcat) or you use Firefox instead.