angularjs - Get encompassing model on ng-change -
i apologize confusing title, problem quite simple.
i have $scope.users variable. ng-repeat them , create input every user's respective valid until property. on ng-change on input want send update request on user service. how can proper user on 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 }); }
pass user function
<div class="row" ng-repeat="user in users" style="margin-bottom:0.5em"> <input type="date" ng-change="setvaliduntil(user)" value="{{user.validuntil}}"/> //...other user properties </div> //in appropriate controller $scope.setvaliduntil = function (data) { //you can update data that. }
Comments
Post a Comment