The problem is that you are running your example off the file system (using the file://
protocol) and many browsers (Chrome, Opera) restricts XHR calls when using the file://
protocol. AngularJS templates are downloaded via XHR and this, combined with the usage of the file://
protocol results in the error you are getting.
You’ve got several options when it comes to resolving this situation:
- Run your examples using a web server (there are many easy solutions like https://code.google.com/p/mongoose/ or a few lines node.js script)
- Embed templates in your index.html file using the
<script>
directive: http://docs.angularjs.org/api/ng.directive:script so your templates are downloaded with the main HTML file and it is no longer necessary to load them via XHR - Change your browser settings to allow XHR calls over the
file://
protocol. For example this can be done in Chrome like so: Allow Google Chrome to use XMLHttpRequest to load a URL from a local file