0

I can't tell what I'm doing wrong as I'm totally new to this.

I've included the following line into my index.html between the header and the footer. Both files reside in the same folder.

<ng-include src="'dishdetail.html'"></ng-include>

Simple, right?

Then I get this error:

angular.js:12373
XMLHttpRequest cannot load 
file:///.../codingstuff/conFusion/app/dishdetail.html. 
Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

How do I get around this? Do I get around this?

muzzo
  • 121
  • 1
  • 3
  • 9
  • You need to open your page from a server. Template requests are done by `XMLHttpRequest `(AJAX) which isn't supported in `file://` protocol – charlietfl Jul 12 '16 at 03:32
  • Yeah, that sounds about right, but the instructor was able to open the page just fine on his computer. Then again, he probably had it running on a server. – muzzo Jul 12 '16 at 03:34
  • Not hard to install a localhost server on your machine....or if using node set up/run node server – charlietfl Jul 12 '16 at 03:35
  • So I tried running this `cd /path/to/dir/with/the/index/file python -m SimpleHTTPServer` as suggested by boris and then got a bunch of 404's. How do I get it to see `"../bower_components/bootstrap/dist/css/bootstrap.min.css"` instead of "bower_components/bootstrap/dist/css/bootstrap.min.css". That is what is throwing off all of the 404's. – muzzo Jul 12 '16 at 03:43
  • I'm new at this. Especially new at node.js. How do I start up a node server? – muzzo Jul 12 '16 at 03:46
  • That's easily determined in web search. If you want bower complements will also need to install bower through npm – charlietfl Jul 12 '16 at 03:48
  • Got it. I just copied the bower components folder to the same folder where the index.html lives. It fixed everything. Though I'd still like to see how I can get "../bower_components..." to work properly as in actually go up one in the directory and call on that folder. – muzzo Jul 12 '16 at 03:51
  • depends on directory structure relative to your page – charlietfl Jul 12 '16 at 03:52
  • By the way, thank you for helping out. How do I uptick your rating? – muzzo Jul 12 '16 at 03:53
  • really only does any good when there is an answer posted...these are just comment blocks – charlietfl Jul 12 '16 at 03:53
  • Well, much obliged. – muzzo Jul 12 '16 at 03:55

0 Answers0