我为令人困惑的标题道歉,问题很简单。
我有一个 $scope.users 变量。我重复它们并为每个用户各自的有效直到属性创建一个输入。在此输入的 ng-change 上,我想在我的用户服务上发送更新请求。如何在我的 ng-change 上获得正确的用户?
<div class="row" ng-repeat="user in users">
<input type="date" ng-change="setValidUntil" value="{{user.validUntil}}"/>
//...other user properties
</div>
//in appropriate controller
$scope.setValidUntil = function () {
User.update({
'studentNumber': $scope.user.studentNumber, // Missing this!!
'validUntil':validUntil
});
}