我在 ng-repeat 中生成了几种形式:
<div class="familyMembers" data-ng-repeat="member in familyMembers">
...
<form class="familyMemberEdit" name="familyMemberEdit_{{ member.spid }}" novalidate>
...
</form>
...
</div>
在相应的控制器中,我想在每个表单上检查 $dirty:
...
var a = '';
var condition = false;
angular.forEach($scope.familyMembers, function(value, key) {
a = 'familyMemberEdit_' + value.spid;
condition = condition || $scope[a].$dirty;
});
return condition;
指$scope[a]
退货undefined
。在这种情况下我应该如何参考$scope.familyMemberEdit_1234
?