$apply already in progress at Error

梦幻女侠 发布于 2013/10/11 21:47
阅读 1K+
收藏 0
<script src="js/angular.min.js"></script>
<script>
function PhoneListCtrl($scope, $http) {
  $http.get('js/05.json').success(function(data) {
    $scope.phones = data;
  });
  $scope.orderProp = 'age';
  $scope.$apply();
}
</script>
</head>
<body ng-controller="PhoneListCtrl">
 Search: <input ng-model="query">
Sort by:
<select ng-model="orderProp">
  <option value="name">name</option>
  <option value="age">age</option>
</select>




<ul class="phones">
  <li ng-repeat="phone in phones | filter:query | orderBy:orderProp">
    {{phone.name}}
    <p>{{phone.snippet}}</p>
    <p>{{phone.age}}</p>
  </li>

</ul>


  1. XMLHttpRequest cannot load file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/js/05.json. Cross origin requests are only supported for HTTP. angular.min.js:101
  1. Error: $apply already in progress at Error (<anonymous>) at g (file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/js/angular.min.js:85:150) at Object.e.$apply (file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/js/angular.min.js:89:362) at e (file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/js/angular.min.js:97:67) at p (file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/js/angular.min.js💯149) at XMLHttpRequest.r.onreadystatechange (file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/js/angular.min.js:101:285) at file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/js/angular.min.js:101:383 at m (file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/js/angular.min.js:98:20) at l (file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/js/angular.min.js:96:241) at Function.l.(anonymous function) (file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/js/angular.min.js:98:450) angular.min.js:62
  1. Error: A network error occurred. at file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/js/angular.min.js:101:383 at m (file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/js/angular.min.js:98:20) at l (file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/js/angular.min.js:96:241) at Function.l.(anonymous function) (file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/js/angular.min.js:98:450) at new PhoneListCtrl (file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/05XHR%E5%92%8C%E4%BE%9D%E8%B5%96%E6%B3%A8%E5%85%A5.html:9:9) at d (file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/js/angular.min.js:27:464) at Object.instantiate (file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/js/angular.min.js:28:80) at file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/js/angular.min.js:51:512 at file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/js/angular.min.js:43:67 at n (file:///D:/ProgramFilesZhtt/tomcat1081/webapps/AngularJS/js/angular.min.js:7:43) angular.min.js:62

加载中
0
yunfound
yunfound
骚年ajax不允许访问本机文件的啦。。。
梦幻女侠
梦幻女侠
之前是首次接触这个语言,现在知道怎么回事了,必须放在服务器中访问才行的,呵呵,还是谢谢你哈
返回顶部
顶部