1

I have this code:

<!DOCTYPE HTML>
<html>
    <head> 
        <script src="angular.js"></script>
        <script src="angularmy.js"></script>
        <link rel="stylesheet" href="angular.css"/>
    </head>
    <body ng-app="myMod" ng-controller="myCont">
        <div ng-include="'angular3.html'">
        </div>
    </body>
</html>

All the files are in the same folder, even angular3.html but when I try to run it gives me this error :

Error: NETWORK_ERR ([arguments not available])@file://localhost/C:/Users/amondapr/Desktop/html/angularjs/ng-include/angular.js:12014 sendReq([arguments not available])@file://localhost/C:/Users/amondapr/Desktop/html/angularjs/ng-include/angular.js:11776 serverRequest([arguments not available])@file://localhost/C:/Users/amondapr/Desktop/html/angularjs/ng-include/angular.js:11571 processQueue([arguments not available])@file://localhost/C:/Users/amondapr/Desktop/html/angularjs/ng-include/angular.js:16383 ([arguments not available])@file://localhost/C:/Users/amondapr/Desktop/html/angularjs/ng-include/angular.js:16399 ([arguments not available])@file://localhost/C:/Users/amondapr/Desktop/html/angularjs/ng-include/angular.js:17682 ([arguments not available])@file://localhost/C:/Users/amondapr/Desktop/html/angularjs/ng-include/angular.js:17495 ([arguments not available])@file://localhost/C:/Users/amondapr/Desktop/html/angularjs/ng-include/angular.js:17790 bootstrapApply([arguments not available])@file://localhost/C:/Users/amondapr/Desktop/html/angularjs/ng-include/angular.js:1761 invoke([arguments not available])@file://localhost/C:/Users/amondapr/Desktop/html/angularjs/ng-include/angular.js:4718

Has anyone else faced this problem , if yes then how to correct it ?

Mistalis
  • 17,793
  • 13
  • 73
  • 97
YepMe
  • 159
  • 2
  • 11
  • I think you need to put your angular app on a webserver (like wampserver, or a vagrant box) – Emile Bergeron Aug 03 '16 at 14:02
  • But why??? The tutorials that i am following have their html file in the same directory – YepMe Aug 03 '16 at 14:05
  • yes, but the whole directory is served through a http server. – Emile Bergeron Aug 03 '16 at 14:05
  • Take a look at that [question](http://stackoverflow.com/q/2886389/1218980) – Emile Bergeron Aug 03 '16 at 14:08
  • You won't be able to load the `angular3.html` template file if you don't use a web server. What you can do to test this without a server is to use an inline-template ` – Titus Aug 03 '16 at 14:09

2 Answers2

2

You have to run a local http server.

Easiest way is using python -m http.server (with Python 3) running in application folder. Then you can just access http://localhost:8000

Karol Klepacki
  • 2,070
  • 1
  • 18
  • 30
0

If you are on Mac you can use MAMP