为了账号安全,请及时绑定邮箱和手机立即绑定

利用ui-router时chrome报错,火狐正常

在template是chrome没问题,用templateUrl是chrome就报错了,求大神解救。

4angular.js:13523 Possibly unhandled rejection: {}(anonymous function) @ angular.js:13523(anonymous function) @ angular.js:10199processChecks @ angular.js:16004(anonymous function) @ angular.js:16010Scope.$eval @ angular.js:17279Scope.$digest @ angular.js:17095Scope.$apply @ angular.js:17387bootstrapApply @ angular.js:1747invoke @ angular.js:4658doBootstrap @ angular.js:1745bootstrap @ angular.js:1765angularInit @ angular.js:1650(anonymous function) @ angular.js:30973trigger @ angular.js:3156defaultHandlerWrapper @ angular.js:3446eventHandler @ angular.js:3434

angular.js:11726 XMLHttpRequest cannot load file:///C:/Users/lWX349253/Downloads/ui-router-demo-master/aa/sub.html. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.(anonymous function) @ angular.js:11726sendReq @ angular.js:11491serverRequest @ angular.js:11201processQueue @ angular.js:15979(anonymous function) @ angular.js:16014Scope.$eval @ angular.js:17279Scope.$digest @ angular.js:17095Scope.$apply @ angular.js:17387(anonymous function) @ angular.js:19216completeOutstandingRequest @ angular.js:5862(anonymous function) @ angular.js:6138

angular.js:13523 Possibly unhandled rejection: {"data":null,"status":-1,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"cache":{},"headers":{"Accept":"text/html"},"url":"aa/sub.html"},"statusText":""}


正在回答

2 回答

看浏览器报错,是 XMLHttpRequest报错。 chrome上要请求服务器的文件,在本地搭建一个本地服务器,以localhost加端口号可以访问。

0 回复 有任何疑惑可以回复我~

chrome 快捷键后面添加  --allow-file-access-from-files,即可

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
AngularJS实战
  • 参与学习       205465    人
  • 解答问题       1158    个

一起学习AngularJS的基础教程,通过实例学习并学会AngularJS

进入课程

利用ui-router时chrome报错,火狐正常

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信