我有一个<div ng-repeat="visit in Visits" ng-controller="INCtrl" ng-if="visit.Status=='IN'">
<div class="row">
<div class="col-lg-7" style="margin:0 auto;margin-top:5px;">
<p>
<b >{{employeeINDetail.empName}}</b>
</p>
</div>
我在其中设置了一个对所有控制器都通用的IP。我在其他控制器中获取了ip并添加了这样的Web服务方法:factory
url : $scope.ipForHttp+"getDeviceDetailsReport"
$scope.ipForHttp
是http://websitename.com/
的{{1}}。
这适用于我的本地计算机。当我主持并打开页面时,我第一次收到所有页面。但是当我刷新页面时,我在控制台中看到错误。
factory
。只有当我刷新页面时才会出现此错误,并且仅在托管站点中,而不是在我的本地计算机中。
我在GET http://websitename.com/undefinedgetDeviceDetailsReport 404 (Not Found)
和方法名称undefined
之间获得/
。
这是我使用getDeviceDetailsReport
中的数据的一些代码:
factory
我只有在刷新页面时才会收到$scope.ipForHttp = userDetailsFactory.getUserDetailsFromFactory().ipAddress;
$scope.loading = false;
$scope.ClientID = userDetailsFactory.getUserDetailsFromFactory().clientidFromSession;
// $scope.dev={};
$scope.getDevice =function(){
$scope.loading = true;
$http({
method : "GET",
url : $scope.ipForHttp+"getDeviceDetailsReport" //i think undefined error here.
。
修改即可。我运行Error: ngRepeat:dupes
Duplicate Key in Repeater
并在每次刷新页面时设置值。也许价值是factory
第二次......但我不知道我仍然有旧的价值。
也许这就是为什么我刷新时会得到undefined
的原因。我做错了什么?
包含Error: ngRepeat:dupes
的索引页面(包含其他html页面)控制器:
factory
答案 0 :(得分:0)
该错误是因为您正在对具有重复项的集合执行ng-repeat。当您对具有重复项的集合执行ng-repeat时,需要按索引进行跟踪。