我收到下面显示的eval错误,但我程序中的所有内容都处于正常工作状态,所以我想知道为什么我会这样做?没有迹象表明问题位于堆栈跟踪的位置。 isChecked(field, value)
是一个函数,它返回一个布尔值,我在ng-model
属性中评估约{70}个ng-repeat
生成的Eval Error: Cannot assign to isChecked(field, val) while evaling [isChecked(field, val)]
FROM:
#0 Expression.assign (package:angular/core/parser/syntax.dart:45:7)
#1 _UnwrapExceptionDecorator.assign (package:angular/core/parser/parser.dart:125:26)
#2 BoundExpression.assign (package:angular/core/parser/syntax.dart:60:41)
#3 NgModel.modelValue= (package:angular/directive/ng_model.dart:211:11)
#4 NgModel.viewValue= (package:angular/directive/ng_model.dart:200:5)
#5 InputCheckbox.InputCheckbox.<anonymous closure>.<anonymous closure> (package:angular/directive/ng_model.dart:318:19)
#6 NgModelOptions._runFuncDebounced (package:angular/directive/ng_model_options.dart:80:11)
#7 NgModelOptions.executeChangeFunc (package:angular/directive/ng_model_options.dart:68:20)
#8 InputCheckbox.InputCheckbox.<anonymous closure> (package:angular/directive/ng_model.dart:317:49)
#9 _rootRunUnary (dart:async/zone.dart:915)
#10 _ZoneDelegate.runUnary (dart:async/zone.dart:510)
#11 VmTurnZone._onRunUnary.<anonymous closure> (package:angular/core/zone.dart:122:55)
#12 VmTurnZone._onRunBase (package:angular/core/zone.dart:104:16)
#13 VmTurnZone._onRunUnary (package:angular/core/zone.dart:122:7)
#14 _CustomZone.runUnary (dart:async/zone.dart:811)
#15 _CustomZone.runUnaryGuarded (dart:async/zone.dart:717)
#16 _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:743)
STACKTRACE:
#0 _UnwrapExceptionDecorator.assign (package:angular/core/parser/parser.dart:127:7)
#1 BoundExpression.assign (package:angular/core/parser/syntax.dart:60:41)
#2 NgModel.modelValue= (package:angular/directive/ng_model.dart:211:11)
#3 NgModel.viewValue= (package:angular/directive/ng_model.dart:200:5)
#4 InputCheckbox.InputCheckbox.<anonymous closure>.<anonymous closure> (package:angular/directive/ng_model.dart:318:19)
#5 NgModelOptions._runFuncDebounced (package:angular/directive/ng_model_options.dart:80:11)
#6 NgModelOptions.executeChangeFunc (package:angular/directive/ng_model_options.dart:68:20)
#7 InputCheckbox.InputCheckbox.<anonymous closure> (package:angular/directive/ng_model.dart:317:49)
#8 _rootRunUnary (dart:async/zone.dart:915)
#9 _ZoneDelegate.runUnary (dart:async/zone.dart:510)
#10 VmTurnZone._onRunUnary.<anonymous closure> (package:angular/core/zone.dart:122:55)
#11 VmTurnZone._onRunBase (package:angular/core/zone.dart:104:16)
#12 VmTurnZone._onRunUnary (package:angular/core/zone.dart:122:7)
#13 _CustomZone.runUnary (dart:async/zone.dart:811)
#14 _CustomZone.runUnaryGuarded (dart:async/zone.dart:717)
#15 _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:743)
属性。如果这是一个问题的任何帮助和建议,将不胜感激:)
<fieldset ng-repeat="field in $.filterFields">
<legend>Filter by {{field}}</legend>
<span ng-repeat="val in $.getValuesForField(field)">
<label>{{val}}</label>
<input type="checkbox" ng-click="$.checkboxClicked(field, val)" ng-model="isChecked(field, val)">
</span>
</fieldset>
复选框的HTML:
bool isChecked(String key, String value){
if(alertFilter.containsKey(key) && alertFilter[key].contains(value)) {
return true;
}
else{
return false;
}
}
isChecked的源代码:
sqlite3_step
P.S。这里的'alertFilter'是从服务中获得的。更新alertFilter时会触发错误 - 这会触发共享此过滤器的程序的其他4个部分进行更新。请注意,这些其他部分不会更新alertFilter,它们只会从中读取。