Ng enable not working in Chrome browser

I am new to AngularJs. I am trying to use the ng-include directive in the index.html file to include a header template. In my local, I run it offline, and not on any web server. On the index page, the header file loads fine on Firefox, but on Chrome. I get the error "Cross-start requests are only supported for HTTP."

Next, several logs from the error stack are added:

The resource is interpreted as Script, but is passed with the MIME type text / html: "file: ///Users/pradeep/Angular_demo/header.html". index.html: 305 XMLHttpRequest cannot load the file: ///Users/pradeep/Angular_demo/header.html.

Cross-start requests are only supported for HTTP. angular.js: 8109 (anonymous function) angular.js: 8109 sendReq

Please help me solve this problem in Chrome so that I can run it as a standalone application.

Regards, Pradeep

+4
source share
1 answer

use the path related to the application directory. ex: header.htmlif Angular_demois the root directory of the project.

Do not attempt to access resources through the protocol file

+2
source

Source: https://habr.com/ru/post/1532877/


All Articles