Angularjs ng仅在IE中重复工作
我正忙着学习Angular+Typescript+bootstrap,却遇到了一个我无法解决的问题。我在局部视图中有一个ng重复:Angularjs ng仅在IE中重复工作,angularjs,typescript,Angularjs,Typescript,我正忙着学习Angular+Typescript+bootstrap,却遇到了一个我无法解决的问题。我在局部视图中有一个ng重复: <div> <h1>Debtors</h1> <table class="table table-hover"> <thead> <tr> <th>Debtor</th> <th class="
<div>
<h1>Debtors</h1>
<table class="table table-hover">
<thead>
<tr>
<th>Debtor</th>
<th class="col-sm-1"></th>
<th class="col-sm-1"></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="Debtor in vm.Debtors">
<td>{{Debtor.Name}}</td>
<td><a href="" ng-click="vm.EditDebtor(Debtor.ID)"><i class="fa fa-pencil fa-fw fa-lg"></i> Edit</a></td>
<td><i class="fa fa-trash-o fa-fw fa-lg"></i> Delete</td>
</tr>
</tbody>
</table>
路由定义为:
$routeProvider.when('/Debtors/ViewDebtors', {
templateUrl: 'App/Views/Debtors/Debtors.html',
controller: Controllers.DebtorsController,
controllerAs: "vm"
});
这在IE中工作得非常好,它可以显示表格和所有数据,但在FireFox或Chrome中似乎不起作用。我已经检查了fiddler,数据返回正确,但表没有显示
有什么想法吗?谢谢 好的,在尝试了几次修复之后,Chrome决定把这个错误吐出来:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
在服务器上启用CORS修复了我的问题。看起来它现在可以在所有浏览器上运行。有控制台错误吗?您是否安装了Chrome Angular扩展来验证债务人返回后的范围?Firefox控制台中没有错误,Chrome将其作为错误给出:GET Angular.js:7889(匿名函数)Angular.js:7889 sendReq Angular.js:7720$http.serverRequest Angular.js:7454 wrappedCallback Angular.js:10655 wrappedCallback Angular.js:10655(匿名函数)angular.js:10741作用域。$eval angular.js:11634作用域。$digest angular.js:11479$delegate。$digest VM48:844作用域。$apply angular.js:11740$delegate。$apply VM48:855(匿名函数)angular.js:8950 jQuery.event.dispatch jQuery-1.9.1.js:3074 elemData.handlen不完全确定angular扩展是如何工作的,但它在根范围下提供了三个范围,一个根范围和两个兄弟范围。第二个范围说:这个范围没有模型,第三个范围有:vm:{ModalService:{…}
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.