Angularjs 在ng repeat对象中使用日期选择器时执行无限$digest循环
我在angularjs中使用ng repeat中的ui引导日期选择器。但在任何日期进行选择时,我都会在控制台中遇到无限的$digest循环错误。我有一个如下的数据结构Angularjs 在ng repeat对象中使用日期选择器时执行无限$digest循环,angularjs,twitter-bootstrap,angular-ui,bootstrap-datepicker,Angularjs,Twitter Bootstrap,Angular Ui,Bootstrap Datepicker,我在angularjs中使用ng repeat中的ui引导日期选择器。但在任何日期进行选择时,我都会在控制台中遇到无限的$digest循环错误。我有一个如下的数据结构 $scope.colorConfigData = [ { "columns": [ { "label": "Employee Id", "type": "int8", "componentType": "Text field", "filter
$scope.colorConfigData = [
{
"columns": [
{
"label": "Employee Id",
"type": "int8",
"componentType": "Text field",
"filters": [
{
"id": "=",
"text": "equal to"
},
{
"id": "!=",
"text": "not equal to"
},
{
"id": "<",
"text": "less than"
},
{
"id": ">",
"text": "greater than"
},
{
"id": "<=",
"text": "less than equal to"
},
{
"id": ">=",
"text": "greater than equal to"
},
{
"id": "between",
"text": "in between"
},
{
"id": "is not null",
"text": "has any value"
},
{
"id": "is null",
"text": "has no value"
}
],
"operator": "=",
"filterValue": "5"
},
{
"label": "Date Of Birth",
"type": "timestamp",
"componentType": "Date",
"filters": [
{
"id": "=",
"text": "equal to"
},
{
"id": "!=",
"text": "not equal to"
},
{
"id": "<",
"text": "less than"
},
{
"id": ">",
"text": "greater than"
},
{
"id": "between",
"text": "in between"
},
{
"id": "is not null",
"text": "has any value"
},
{
"id": "is null",
"text": "has no value"
}
],
"operator": "=",
"first_dt_inp_opnd": false,
"filterValue": "2015-07-27T18:30:00.000Z"
}
],
"colorColumns": [
{
"label": "Employee Id",
"type": "int8",
"componentType": "Text field"
},
{
"label": "Date Of Birth",
"type": "timestamp",
"componentType": "Date"
}
]
}
]
非常感谢您的帮助。我的错!!datepicker和ng repeat都没有问题。不知何故,我又将日期模型包装为new date()。所以描述了无限的$digest循环。我的坏!!datepicker和ng repeat都没有问题。不知何故,我又将日期模型包装为new date()。因此,描述了无限的$digest循环。请粘贴具有open function编辑的open function的控制器。请粘贴具有open function编辑的open function的控制器。
<div class="row" ng-repeat="colorCombination in colorConfigData" ng-form="colorCombinationForm">
<select class="form-control" ng-change="updateColorColumnFilter(colorCombination.currentColumn, $index)" ng-model="colorCombination.currentColumn" ng-options="colorColumn as colorColumn.label for colorColumn in colorCombination.colorColumns" name="colorColumn" data-placeholder="{{entity + 'Select Column'| translate}}">
<option value="">Select Column</option></select>
<div ng-repeat="colorConfig in colorCombination.columns" ng-form="colorForm">
<!-- choose operator-->
<!-- if colorConfig.operator === int8, then text box -->
<!-- if colorConfig.operator === timestamp, then datepicker below -->
<input type="text" class="form-control" placeholder="{{format}}" datepicker-popup="{{format}}" name="filterValFirst" required ng-model="colorConfig.filterValue" is-open="colorConfig.first_dt_inp_opnd"/>
<span class="input-group-btn"><button class="btn btn-default" ng-click="open($event, 'first_dt_inp_opnd', colorConfig)"><i class="glyphicon glyphicon-calendar"></i></button></span>
</div>
</div>
//Open function
$scope.open = function($event, opened, element) {
$event.preventDefault();
$event.stopPropagation();
element[opened] = true;
};