问题描述:

I install yeoman and bootstrap an angularjs project.

I use grunt server command to debug and code. But when I use command 'grunt build'. It generates dist folder. But when I run index.html have javascript error like that:

XMLHttpRequest cannot load file:///home/cuongcua/project/magic-listen/dist/views/main.html. Cross origin requests are only supported for HTTP.

网友答案:

You can use grunt server:build

You can't use AngularJs without server except if you enable CSP (Content Security Policy) support. http://docs.angularjs.org/api/ng.directive:ngCsp

grunt build is use when you need to build your application and copy your dist folder on a server.

网友答案:

The simplest solution is:

cd dist
python -m SimpleHTTPServer
相关阅读:
Top